The Dart code generator for your package versions.
There is no way to get the package version from the code in the Dart ecosystem.
- Add build_runner and VersionGen to your package’s pubspec.yaml file:
dev_dependencies: build_runner: version_gen:
- Install VersionGen
$ flutter pub get
- Use VersionGen
$ flutter packages pub run build_runner build
VersionGen generates dart files based on the key
Default configuration can be found here.
# pubspec.yaml # ... dev_dependencies: build_runner: version_gen: # Optional (default: lib/gen/) version_gen: path: lib/gen/
/// DO NOT MODIFY BY HAND, Generated by version_gen String packageVersion = '1.0.0+1';
Please file [FlutterGen] specific issues, bugs, or feature requests in our issue tracker.
Plugin issues that are not specific to [FlutterGen] can be filed in the Flutter issue tracker.