In flutter a made a linux application. Is consumes an endoint that varies depending the environment I need to build for. For each environment I have a different main
file:
main-prod.dart
main-staging.dart
main-dev.dart
All files are located into `./lib/ folder with the rest of source codeDuring building for desktop application via:
flutter build linux
orflutter build windows
orflutter build macos
During run
I can provide via -t
parameter for example for local development I run:
flutter run -t ./lib/main-dev.dart
But how on Chirst's sake I can do the same for buidling as well?
In you case you can build your application via:
flutter ^device^ -t ^main_file^
Where ^device^
are one of the following:
And the ^main_file^ is the one you use during
flutter run` in your case you have theese commands to select from:
environment | file | windows | linux | macos |
---|---|---|---|---|
production | main-prod.dart | flutter build windows -t ./lib/main-prod.dart | flutter build linux -t ./lib/main-prod.dart | flutter build macos -t ./lib/main-prod.dart |
development | main-dev.dart | flutter build windows -t ./lib/main-dev.dart | flutter build linux -t ./lib/main-dev.dart | flutter build macos -t ./lib/main-dev.dart |
staging | main-staging.dart | flutter build windows -t ./lib/main-staging.dart | flutter build linux -t ./lib/main-staging.dart | flutter build macos -t ./lib/main-staging.dart |