Search code examples
flutterdartdart-define

Google Play Store does not see dart define variable


I have a silly question about dart define and Google Play Store configuration. After upload the version of the app variables from dart define from file does not work at all. What should I do make it run?

I have config.json file with keys. I've changed launch.json file in vs code adding:

 "args": [
                "--flavor",
                "prod",
                "-t",
                "lib/main_prod.dart",
                "--dart-define-from-file",
                "config.json"
            ],

I am building abb with:

fvm flutter build appbundle --release --flavor prod -t lib/main_prod.dart

and when I upload version into Google Play Store it does not work at all.


Solution

  • You need to specify the dart-define config file in your build command:

    fvm flutter build appbundle --release --flavor prod -t lib/main_prod.dart --dart-define-from-file config.json