dart create
This guide describes how to use the dart create
command to create a Dart project.
Overview
#The dart create
command creates a Dart project, using one of several supported templates. The same functionality is available in IDEs.
When you run dart create
, it first creates a directory with the project files. Then it gets package dependencies (unless you specify the --no-pub
flag).
Create a basic Dart project
#To create a basic Dart project, follow the dart create
command with the name of your project. In the following example, a directory named my_cli
that contains a simple console app (the default template) is created:
dart create my_cli
Specify a template
#To use a different template, use the -t
(or --template
) flag followed by the template name:
dart create -t web my_web_app
The -t
flag allows you to specify which type of Dart project you want to create. If you don't specify a template, dart create
uses the console
template by default.
Available templates
#The following table shows the templates you can use with the -t
flag:
Template | Description |
---|---|
cli | A command-line application with basic argument parsing using package:args . |
console | A command-line application (default template). |
package | A package containing shared Dart libraries. |
server-shelf | A server built using shelf. |
web | A web app built using core Dart libraries. |
These templates result in a file structure that follows package layout conventions.
Additional options
#Additionally, you can perform the following actions with the dart create
command.
Force project creation
#If the specified directory already exists, dart create
fails. You can force project generation with the --force
flag:
dart create --force <DIRECTORY>
Get help
#For further information on command-line options, use the --help
flag:
dart create --help
Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-07-24. View source or report an issue.