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

后端 未结 9 1628
清歌不尽
清歌不尽 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:42

    Simply you can implement build variants.

    In android:

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
        debug{
            applicationIdSuffix ".dev"
            signingConfig signingConfigs.debug
        }
       qa{
            applicationIdSuffix ".qa"
            signingConfig signingConfigs.qa
        }
    }
    
    
    productFlavors {
    
      dev {
          dimension "app"
          resValue "string", "app_name", "xyz Dev"
          applicationId "com.xyz.dev"
      }
      prod {
          dimension "app"
          resValue "string", "app_name", "xyz"
      }
    }
    

    In iOS :

    add configuration by selecting project->runner-> configuration add one more

提交回复
热议问题