Hello everyone, I need some help with multi environment in flutter.
Expected result:
Quite easy, right? ) No!
What I have tried:
ENFILE=.env.dev flutter run ..., so with this approach you loose advantages of Flutter run console in android studio and flutter app not rerun automatically--dart-define= approach - long lines of run command, hard to read, hard to change, code repetition for flutter run and flutter buildIt looks like I have missed something, I have come from react-native ant all this question resolved by react-native-config and command in package.json but in flutter I don't see ways for predefined command like in package json (only Run/Debug Configurations). But flutter run don't support env files but just sh scripts possible run with ENFILE but they don't trigger the flutter run console.
I will be grateful for your help ))
Possible solution to use android run configurations with.
The schema will be next:
This schema faced all requirements except "possible to run from Xcode". In common it still possible to run project from Xcode but to change configuration inside xcode to other env it still necessary to run project from android run configuration.
There more information and code example:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With