How do I build different versions of my Flutter app for qa/dev/prod?

后端 未结 9 1609
清歌不尽
清歌不尽 2020-12-01 00:14

I am building a Flutter app, and I have variables with different values for different environments (QA, dev, prod, etc). What\'s a good way to organize my app so I can easil

9条回答
  •  萌比男神i
    2020-12-01 00:49

    Starting from Flutter 1.17 you can use --dart-define to build your app with different compile time variables. It works for both Dart and native layers. In dart you get these values with String.fromEnvironment for example. In that way you won't need to have tons or entry points and expose your environment credentials

    Here is an article that explains more https://link.medium.com/ibuTsWHrk6

提交回复
热议问题