title: How do you use Flutter Flavors in Xcode
body: <p>I have an existing project (20k lines of code) that I now want to build for iOS (The project has been developed and tested using Android, though I did check that every package it depends on indicates iOS support.)</p>
  
  <p>I'm completely new to Mac (It took me a while to figure out how even to launch apps via the GUI) but I managed to work through the Flutter setup guides for MacOS.</p>
  
  <p>Flutter doctor shows all OK and so far the Sample Flutter app can run on the Xcode iPhone simulator. </p>
  
  <p>The app needs to have a flavor specified when built or launched, - on the android side I have dev, qa, and prod, each with full and free, ie 6 flavors in total and separate entry points.</p>
  
  <p>Right now when I try to Run the app on the simulator from Android Studio, I get the error </p>
  
  <blockquote>
    <p>The Xcode project does not define custom schemes.<br>
    You cannot use the --flavor option.<br>
    Could not build the application for the simulator.<br>
    Error launching the application on iPhone 11 Pro Max.  </p>
  </blockquote>
  
  <p>On the android side I use multiple src directory structures with AndroidManifest files and separate mipmap resource directories, plus a script to switch the asset-bundle based on the flavor.  The Flavors each specifies a specific main-*.dart entry point / target and there are a series of googleservices.json files also corresponding to the flavors.</p>
  
  <p>I now need a way to translate all of that to xcode - I gather that it is called "Schemas".  I gather I need a tool to set up the schemas (and where that fails, a script to set up per-flavor parts during the build process).  Or are they called Runner Profiles?</p>
  
  <p>My question is where is this tool.  Is there a command-line version?  Can I somehow launch the Xcode GUI and set up Schemas for a project that lives in Android Studio?  A lot of the terminology used in the many blogs that cover this will probably become clear once I can actually see what it looks like.</p>
  
  <p>Once I have the tooling in place I realise from reading other people's questions that the next hurdle will be to see where specific setup/tweaking is required to get the iOS build to pass, I gather this is particularly an issue with some packages, but for now I'm still working out the tooling.</p>
  
  <p>Possibly related to "my next hurdle", or possibly related to incomplete tooling setup, when I try to run the app on the Simulator without any flavor specified, it tells me that the Xcode build completes and the app is installed on the simulator, but it fails with a Stack trace.  My guess is that it is telling me that it doesn't have a googleservices.json file (which should be sorted out once the correct (googleservices-plist.info?) file is set, based on the flavor is activated - but where and how is this done?)</p>
  
  <p>It could also be due to permissions, or even package errors.</p>
  
  <p>Edit:  The call stack refers to FIRapp configure and FLFirebaseMessagingPlugin registerWithRegistrar. This hints at the missing googleservices config that is obviously not yet available - since it is flavor specific and I need to set that up.</p>
  
  <p>Some pointed/specific questions:<br>
   1. Does flutter run and flutterbuild pass the "flavor" parameter as the name of a scheme to xcode? I would assume the answer is yes, else there needs to be a mapping somewhere.<br>
   2. How do I set up schemes for every flavor in xcode (with cognisance for the fact that the project is in Android Studio).<br>
   3. What is the iOS equivalent for the AndroidManifest.xml, specifically for specifying the applicationID and Launcher Icon and Application "Label"<br>
   4. How does one specify per-Schema (per flavor) googleservices.json files for iOS?<br>
   5. How / where does one set per-schema launcher icons?  </p>
  
  <p>I guess I could do all of the above by having a script that replaces the "default schema" files using a set of files beloning to a specified "flavor" - this is the strategy I use because Flutter Flavors doesn't extend to the assets or for that matter anything set in the pubspec.yaml file - but I prefer to use supported tools as far as possible over hackish solutions.</p>