Create a new app for either iOS or Android using Flutter

Viewed 3031

How to create a new project using Flutter either for iOS or Android?

I tried with flutter create projectname but it is creating both iOS and Android platform.

Is it possible for any one platform?

4 Answers

You can use the --platforms parameter to specify which platforms you want to create the app for (defaults to all of them). So, if you want to create an app for only android you would do something like the following:

flutter create --platforms android my_app

Note: the -i and -a parameters are for selecting the language used, not restricting which platforms are generated.

Lastly: It does seem that you can simply delete the undesired platform directories after they are generated.

Just delete the android or ios folder created in the project.
You can also leave the folders and just not build for the platform you don't want to support.

The question is for creating a new project either for Android or iOS. Not for building. Please follow the steps given in this tutorial Get Started.

In a nutshell

  1. Get the Flutter SDK Update your path with flutter SDK
  2. Run flutter doctor to make sure, flutter is installed correctly
  3. Install the Flutter and Dart plugins for Android Studio
  4. Create new flutter app by following this tutorial

Hope this helps

If you want to create only Android or iOS project just run

(--ios-language select between swift or object-c)

flutter create  -i, --ios-language             [objc (default), swift]

flutter create  -a, --android-language         [java (default), kotlin]

Same for android

Related