简体   繁体   中英

Can the Flutter build number be maintained outside of the pubspec.yaml file

I often flip back and forward between VC branches. I also increase the build number fairly often but not on every run / hot restart / hot reload.

Is there a way have the build number kept out of the pubspec.yaml file and have the IDE manage it so that I don't need to keep on either reverting the pubspec changes or else be forced to commit it, since going backwards cause the app to lose it's internal storage and Local Preferences.

I'm have seen that one can use flutter run --build-number=123 but this requires me to manually check what is in pubspec.yaml, plus I can't just press the "play" button to flip between emulators, flavors, etc, and the console output in the terminal is not as convenient to parse / etc as that in the run-output screen.

Maintaining the build number and version in the pubspec.yaml file is in any case painful, but I'm not ready to take my quick-and-dirty project to an external build process like Jenkins yet. I in any case think that won't solve the same problem (hot-reload / restart in the IDE)

I haven't used it in my current projects, but there's a fairly new package that helps with maintaining the pubspec version: https://pub.dev/packages/pubspec_version/

Maybe this is what you are looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM