Flutter Packages
Pre-Requirements
Flutter installed on device.
Creating a Flutter Package
-
- I use Visual Studio Code to modify Flutter Packages
Adding Package to a Flutter Project
https://flutter.dev/docs/development/packages-and-plugins/using-packages
Reference: adding-packages-in-flutter-app
Updating Flutter Project Package Dependencies
Updating Flutter Packages (Plugins) Automatically
-
Run Pub Outdated
-
Run
$ flutter pub upgrade --major-versions
This will update thepubspec.yaml
file for you. -
Review and resolve your dart code for outdated methods.
Updating Flutter Packages (Plugins) Manually
Use $ flutter pub deps
to view dependency tree.
-
Update to the latest stable dart version by updating the Android Studio Dart Plugin
-
in the terminal run
$ dart --version
to get the installed version of dart.<Repository Path>$ dart --version Dart SDK version: 2.12.1 (stable) (Wed Mar 10 10:18:47 2021 +0100) on "linux_x64" <Repository Path>$
-
For each Flutter Package view the versions and select the flutter package based on the
Min Dart SDK
.Choose a version that has the same first digit build number.
Example: installed dart is
2.12.01 (stable)
so choose packages that supportMin dart SDK
of2.0.0
Choosing the lowest version and adding the
^
allows the compiler to determine a compatible version (this is calledVersion Solving
). -
Run
Pub upgrade
and resolve any package version issue messages
From GitHub
Reference: How to modify an existing pub package to use in your flutter project
-
Find the repository on GitHub
-
Fork the repository
-
Commit and push changes
-
Add repository as a flutter pubspec yaml depencency
dependencies:
flutter:
sdk: flutter
[package-name]:
git:
url: https://github.com/[git-username]/[git-repository-name]
From Flutter pub.dev, or local package
From Local Directory
Journal
- 2020.07.04 Created file
- 2020.07.05 Added
Adding Flutter Packages
section - 2020.07.11 Added
Adding package from Github
section - 2021-04-09 Added
Updating Flutter Project Package Dependencies
section