Flutter devs often need to include packages that are hosted on GitHub(I've had to personally do this a couple of times), especially when using the latest source code of a package that hasn't been published yet. This guide explains how to add a GitHub package to your Flutter project.
To include a package from a public GitHub repository, specify the package in your
pubspec.yaml under dependencies.
1dependencies:2 some_package:3 git:4 url: https://github.com/username/some_package.git
You can target a specific branch using the
1dependencies:2 some_package:3 git:4 url: https://github.com/username/some_package.git5 ref: branch-name
To pin the package to a specific commit, use the commit's SHA hash in the
1dependencies:2 some_package:3 git:4 url: https://github.com/username/some_package.git5 ref: commit-hash
For packages that are developed locally or are not yet pushed to a remote repository, you can reference them by their local paths.
1dependencies:2 local_package:3 path: ../path/to/local_package
After adding the package to
flutter pub get in your terminal to fetch the package. Then, you can import and use the package in your Dart files.
pubspec.yaml matches the package name defined in the package's own