I cannot initialize Flutter for web after adding flavors to my project

Viewed 915

I have a Flutter project that currently builds for iOS and Android. I created the project around Flutter v1.9 or so. Since creating the project, I have added flavor support to my project (dev, prod) via the guide found here

However, after having done this, it doesn't seem like I am able to add web support to my project. Following Flutter's official instructions to enable web for a pre-existing project, I try to run flutter create . in the root directory of the project. When I do this I get the output:

The Xcode project defines schemes: dev, prod You must specify a --flavor option to select one of the available schemes.

So I try to run: flutter create . --flavor=dev and get Multiple output directories specified. Try moving --flavor=dev to be immediately following create

Soooo, I try: flutter create --flavor=dev . and get Could not find an option named "flavor".

Does anyone know how I can initialize web for this project? Thanks.

1 Answers

You need to do the following:

  1. Goto root folder and rename manually ios folder temporarily to something like ios1

  2. Goto terminal and make sure you are standing in root, then run this line:

    flutter create --platforms=web .

  3. Return to project folder and rename back manually ios1 to ios

  4. Done

Related