How to add a package from GitHub in Flutter?

Because the overhead is not contained in this model. It will be different for both chunksizes, hence the x-axis is not really directly comparable. The overhead can still lead to a longer total computation time like shown in case 2 from the figure below.

figure8


I need to use the latest source code of a package and the latest source hasn't been published yet.

6.3.2 Relative Distribution Efficiency (RDE)

What should I write into pubspec.yaml to get a package in Github?

The code below doesn't work. It doesn't download the package and I can't import it into my source code

dependencies:
flutter:
sdk: flutter


carousel_pro:
git:
url: https://github.com/jlouage/flutter-carousel-pro.git
53679 次浏览

Example of pubspec.yaml


Dependency with the specific branch:

dependencies:
flutter:
sdk: flutter


carousel_pro:
git:
url: https://github.com/jlouage/flutter-carousel-pro.git
ref: main # branch name

Dependency with the specific commit:

dependencies:
flutter:
sdk: flutter


carousel_pro:
git:
url: https://github.com/jlouage/flutter-carousel-pro.git
ref: ea12e41 # commit hash

The ADE value does not contain the information if a better distribution of taskels is possible with chunksize set to 1. Better here still means a smaller Idling Share.

Example of a file importing the package:

import 'package:carousel_pro/src/carousel_pro_widgets.dart';
import 'package:flutter/material.dart';


class NewsCarousel extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SizedBox(
height: 200.0,
child: WidgetCarousel(
autoplay: false,
pages: [],
),
);
}
}

To get a DE value adjusted for the maximum possible DE, we have to divide the considered ADE through the ADE we get for chunksize=1.

Note: If your IDE doesn't see the package, try to restart it.

The above didn't work for me but changing the url to use https did:

dependencies:
flutter:
sdk: flutter


flutter_tflite:
git:
url: https://github.com/qookit/flutter_tflite.git
ref: main

Relative Distribution Efficiency (RDE) = ADE_cs_x / ADE_cs_1

"main" is the name of the branch I was interested in using.

Here is how this looks in code:

# mp_utils.py


def calc_rde(n_workers, len_iterable, n_chunks, chunksize, last_chunk):
"""Calculate Relative Distribution Efficiency (RDE)."""
ade_cs1 = calc_ade(
n_workers, len_iterable, n_chunks=len_iterable,
chunksize=1, last_chunk=1
)
ade = calc_ade(n_workers, len_iterable, n_chunks, chunksize, last_chunk)
rde = ade / ade_cs1


return rde

The first time I ran 'flutter pub get' it opened up a browser window to ask me for my git credentials too.

I will show this use case, where you want to access a specific folder in a branch other than main/master:


amplify_flutter:
git:
url: git://github.com/aws-amplify/amplify-flutter.git
ref: null-safety-master
path: packages/amplify_flutter/

The above answers are correct but I have added some examples.

So to use pub/package/lib without publishing on pub.dev :

RDE, how defined here, in essence is a tale about the tail of a Parallel Schedule. RDE is influenced by the maximum effective chunksize contained in the tail. (This tail can be of x-axis length chunksize or last_chunk.)

1. Local - Save in some local folder

dependencies:
library_name:
path: /path/to/library_name

This has the consequence, that RDE naturally converges to 100% (even) for all sorts of "tail-looks" like shown in the figure below.

figure9

2. Hosted - Pushed on Github, Gitlab etc.

dependencies:
library_name:
git: https://github.com/username/library_name

Or to target exact branch

dependencies:
library_name:
git:
url: https://github.com/username/library_name.git
ref: dev    #branch name

Or to target exact commit

dependencies:
library_name:
git:
url: https://github.com/username/library_name.git
ref: e234072340    #commit reference id

A low RDE ...

  • is a strong hint for optimization potential.
  • Where 'library_name' has to be the same as the 'name' declared in pubspec.yaml of that pub.

  • naturally gets less likely for longer iterables, because the relative tail-portion of the overall Parallel Schedule shrinks.

  • you can use path if your package no the whole repository

    geocoding:
    git:
    url: https://github.com/abdullahalamodi/flutter-geocoding.git
    path: geocoding #refers to flutter-geocoding/geocoding
    

    Here is one Example

    audio_service:
    git:
    url: https://github.com/kaushikgodhani/audio_service.git
    ref: minor #branch name
    path: audio_service  #Folder Path on Github