9

Is there any way to pass -FIRAnalyticsDebugEnabled flag to a flutter app when using flutter run on the command line?

I've added it to the scheme in XCode, so that when I run through XCode (by building and running the Runner scheme) the flag is passed, but when I run from the command line it doesn't get passed.

There does seem to be a --flavor command line flag for flutter run which claims it would let me select a scheme to run, but passing --flavor=Runner results in an error saying the scheme isn't found. I'm not sure how to use this flag or find docs for it.

Daniel Brotherston
  • 1,954
  • 4
  • 18
  • 28
  • https://stackoverflow.com/questions/44250184/setting-environment-variables-in-flutter to pass values to Dart. That doesn't work to pass it to native code (Java,ObjectC). – Günter Zöchbauer Aug 30 '18 at 11:20
  • 1
    See also https://medium.com/@salvatoregiordanoo/flavoring-flutter-392aaa875f36, https://cogitas.net/creating-flavors-of-a-flutter-app/, https://github.com/flutter/flutter/issues/11547, https://github.com/flutter/flutter/issues/11547 – Günter Zöchbauer Aug 30 '18 at 11:23

1 Answers1

7

Spent a lot of time on this. Basically currently after you add launch argument to XCode scheme there is no simple way to flutter run with these arguments, here is the issue related to this.

The workaround I used is to run the app from XCode.

almeynman
  • 7,088
  • 3
  • 23
  • 37