Guide to "flutter create" command for creating projects

Flutter create command and arguments for creating projects

To interact with Flutter, we use the flutter command-line tool. We can give it a variety of commands, but the focus will be on the flutter create command. First, we'll go over how to use it to create new Flutter projects and then we'll go through the list of the command line arguments available for the create command with additional information provided for some of them.

Note: This article used Flutter version 3.0 on Windows System.

The flutter command-line tool is mostly used to manage app development by giving it a command followed by arguments:

flutter <command> [arguments]

List of commands for the "flutter" tool

To list all the available commands, we type in the terminal:

flutter help

The flutter CLI has many commands, here are commands that deal with projects:

analyze Analyze the project's Dart code.
assemble Assemble and build Flutter resources.
build Build an executable app or install bundle.
clean Delete the build/ and .dart_tool/ directories.
create Create a new Flutter project.
drive Run integration tests for the project on an attached device or emulator.
format Format one or more Dart files.
gen-l10n Generate localizations for the current project.
pub Commands for managing Flutter packages.
run Run your Flutter app on an attached device.
test Run Flutter unit tests for the current project.

The rest of this post will focus on the flutter create command.

Note: We can learn more about each of the commands by typing the following in the terminal flutter help <command>.

Creating a project with the flutter create command

We use the "flutter create" command to create a new Flutter project. If the project already exists, any missing files will be recreated. We use it like this:

flutter create <output directory> [arguments]

To create a default app Flutter project, we may ignore the arguments and only specify the output directory where all the project files will be created.

The output directory must contain a valid dart package name (all lowercase with an underscore between words), for example:

flutter create my_start_app

A project named my_start_app will be created inside the directory with the same name.

Note: We can use the --project-name argument to have the output directory name that is different from the project name and does not obey this requirement (for example, if we wanted to have MyApp as an output directory instead of my_start_app).

Running a project with the "flutter run" command

After creating the project, go inside the newly created project folder and run the project:

cd my_start_app
flutter run

The flutter should now ask you on which platform you want to run the project.

Multiple devices found:
Windows (desktop) • windows • windows-x64    • Microsoft Windows
Chrome (web)      • chrome  • web-javascript • Google Chrome
Edge (web)        • edge    • web-javascript • Microsoft Edge
[1]: Windows (windows)
[2]: Chrome (chrome)
[3]: Edge (edge)
Please choose one (To quit, press "q/Q"):
Note: Which platforms will be listed depends on what is installed in your system. For Windows (desktop), Visual Studio 2019 or higher is required, while the Android virtual device (AVD) needs to be running for the Android mobile app.

After selecting a platform, the project will run in debug mode. The project itself will be a fairly simple counter app as seen below:

Flutter default counter app after using 'flutter create' command.

The starting point for the project is located at lib/main.dart file. This is where you'll find the counter app's logic and user interface.

Let's turn our attention to the command-line arguments.

Command-line arguments for the "flutter create" command

Below is the list of all the available parameters for the create command:

-h, --help Print this usage information.
--[no-]pub Whether to run "flutter pub get" after the project has been created.

(defaults to on)
--[no-]offline When "flutter pub get" is run by the create command, this indicates whether to run it in offline mode or not. In offline mode, it will need to have all dependencies already available in the pub cache to succeed.
--[no-]overwrite When performing operations, overwrite existing files.
--description The description to use for your new Flutter project. This string ends up in the pubspec.yaml file.

(defaults to "A new Flutter project.")
--org The organization responsible for your new Flutter project, in reverse domain name notation. This string is used in Java package names and as prefix in the iOS bundle identifier.

(defaults to "com.example")
--project-name The project name for this new Flutter project. This must be a valid dart package name.
More Info ↓
-i, --ios-language The language to use for iOS-specific code, either ObjectiveC (legacy) or Swift (recommended).

[objc, swift (default)]
-a, --android-language The language to use for Android-specific code, either Java (legacy) or Kotlin (recommended).

[java, kotlin (default)]
--platforms The platforms supported by this project. Platform folders (e.g. android/) will be generated in the target project. This argument only works when "--template" is set to app or plugin. When adding platforms to a plugin project, the pubspec.yaml will be updated with the requested platform. Adding desktop platforms requires the corresponding desktop config setting to be enabled.

[ios (default), android (default), windows (default), linux (default), macos (default), web (default)]
-t, --template=<type> Specify the type of project to create.

(default) Generate a Flutter application.
Generate a project to add a Flutter module to an existing Android or iOS application.
Generate a shareable Flutter project containing modular Dart code.
Generate a shareable Flutter project containing an API in Dart code with a platform-specific implementation through method channels for Android, iOS, Linux, macOS, Windows, web, or any combination of these.
Generate a shareable Flutter project containing an API in Dart code with a platform-specific implementation through dart:ffi for Android, iOS, Linux, macOS, Windows, or any combination of these.
Generate a List View / Detail View Flutter application that follows community best practices.
More Info ↓
-s, --sample=<id> Specifies the Flutter code sample to use as the "main.dart" for an application. Implies "--template=app". The value should be the sample ID of the desired sample from the API documentation website. An example can be found here.
More Info ↓
--list-samples=<path> Specifies a JSON output file for a listing of Flutter code samples that can be created with "--sample".
More Info ↓

Additional information about the command line arguments

In this section, additional information for some of the command-line arguments mentioned above has been added. Not many arguments are in this section currently, but more might get added in the future.

Using the --sample argument

This command, as the name implies, deals with samples. A sample is useful if we want to develop a starting Flutter project for a specific widget instead of the basic counting app.

To use the --sample argument, we need to provide it with a valid id of the sample.

For example, to create a project with the sample of SingleChildScrollView widget, we would give the following flutter command:

flutter create mysample --sample=widgets.SingleChildScrollView.1
Note: Learn more about which id's are valid when creating a project with --sample parameter.

Using the --list-samples argument

With Flutter version 3.0.3, there are 543 samples with some widgets having more than one sample to demonstrate different settings and some widgets will also have samples for "material", "cupertino" & "widgets" libraries while using the exact same content of the main.dart source file.

We can use the --sample command to generate a list of all available samples in JSON format.

flutter create --list-samples=<path>

The <path> specifies the location of the JSON output file where the list will be saved.

Here's an example of an entry from the created JSON file:

    "id": "material.ScaffoldState.showBottomSheet.1",
    "element": "ScaffoldState.showBottomSheet",
    "sourcePath": "lib/src/material/scaffold.dart",
    "sourceLine": 2493,
    "channel": "stable",
    "serial": "1",
    "package": "flutter",
    "library": "material",
    "copyright": null,
    "description": "This example demonstrates how to use `showBottomSheet` to display a\nbottom sheet when a user taps a button. It also demonstrates how to\nclose a bottom sheet using the Navigator.",
    "file": "material.ScaffoldState.showBottomSheet.1.dart"

Using the --project-name argument

When creating a new project with flutter create, we must specify the output directory. This will create a folder that will contain the Flutter project with the same name. The project name needs to be a valid Dart package name (lower case with underscores), otherwise. we get an error.

For example, if we try to create a TestApp project:

flutter create TestApp

We get the following error message:

"TestApp" is not a valid Dart package name.

See for more information.

We can use the --project-name argument to provide the Flutter with the valid dart package name and at the same time give a folder name that does not follow the dart package naming requirements.

In the previous example, we could create a folder TestApp but have a project with a valid dart package name test_app using the following command:

flutter create TestApp --project-name=test_app

Creating project files on the current directory

Another use of the --project-name argument is when we want to create all project files in the current directory. We just put the . (dot) for output directory like so:

flutter create . --project-name=test_app

Using the --template argument

The skeleton template is for developers who require more than what the default counter app provides. It is larger than a counter app and contains a static list/detail as well as a dynamic settings feature. To learn more about the skeleton template, check this article.


In this tutorial, we looked at all of the available commands for the flutter command-line tool. Then we focused on the flutter create command which is used to build new Flutter projects. We then listed all the options available for it and for some of them, additional information has been provided.

Write a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.