Package Management for Dart, Flutter
Part of Series - Flutter/Dart Series
Flutter/Dart Dependencies 101
Dart Pubspec.yaml file 101
Flutter Dependencies 101
Information on managing package dependencies can be found here: https://dart.dev/tools/pub/dependencies
Importing a Dart Package dependency - ?same for Flutter?
Normal pub dev dependency
Local path dependency - absolute path
Local path dependency - for 1 directory up
/prjdir /lib <-- package to use /example (pubspec.yaml) /lib
dependencies: plugin1: path: ../
dependencies: plugin1: git: url: git://github.com/flutter/plugin1.git
Flutter, Dart Building Intermediate
Different flavors in Flutter?
Can we have environments with different yaml such as test, prod, stag and so on. Like the flavor of android.
By design, different developers or environments are not allowed to have different pubspec.yaml.
So if you want to eg test a plugin in your local setup, then your own development environment should NOT be reflected in the shared source code. The best solution is to include the git path or some other common location in the shared pubspec.yaml and modify your local file to point to your relative path. Your local pubspec.yaml should of course not be checked into source control.
Have you considered the workaround of having the file, and then having a small script you can run that renames pubspec.yaml to pubspec.old and pubspec.local.yaml to pubspec.yaml when you start developing, and then back again before hitting source control?