dart create
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).
Here’s an example of using dart create
to create a directory named my_cli
that contains a simple console app (the default template):
$ dart create my_cli
To use a different template, such as web
, add a template argument:
$ dart create -t web my_web_app
The following table shows the templates you can use:
Template | Description |
---|---|
console |
A command-line application. |
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.
If the specified directory already exists, dart create
fails.
You can force project generation with the --force
flag:
$ dart create --force <DIRECTORY>
For further information on command-line options, use the --help
flag:
$ dart create --help