In the previous lesson, we set up the Dart environment and finished installing the Dart SDK. In this lesson, we’ll create our very first Dart project.
Creating a New Dart Project
- Open CMD terminal, create a folder for your projects and navigate into it. You can make a dedicated folder to store all your Dart projects, for example
C:\dartdemo
mkdir dartdemo
cd dartdemo
- Run the project generation command below to build a console-based project named firstdart. Feel free to replace firstdart with any project name you like.
dart create firstdart

What This Command Does
dart create firstdart generates a command-line project called firstdart. It automatically creates all standard folders and files, then runs pub get to pull down all required dependencies for you.
Here’s the full list of files generated automatically:
Key Auto-Generated Files
.gitignore: Git ignore rules fileanalysis_options.yaml: Linting and static code analysis configurationpubspec.yaml: Core Dart project config file, stores project metadata and dependency listbin/firstdart.dart: Program entry point filelib/firstdart.dart: Directory for reusable business logic codetest/firstdart_test.dart: Unit test source file
Running Your First Dart Program
- Move into your newly created project subfolder
cd firstdart
- Execute the run command
dart run
- You’ll see the following output if everything runs correctly
Building package executable...
Built cli:cli.
Hello world: 42!Code language: CSS (css)
Editing Code and Rerunning the App
1. File Breakdown
The bin/ folder holds all executable entry scripts, and bin/firstdart.dart acts as the launch file for the whole program.
Every Dart application starts executing from the main() function.
2. Modify the Source Code
import 'package:cli/cli.dart' as cli;
void main(List<String> arguments) {
print('Hello world: ${cli.calculate()}!');
}
Code language: JavaScript (javascript)
Here’s the edited version — we’ll remove the import statement and update the printed text:
void main(List<String> arguments) {
print('Hello, Dart!');
}
Code language: JavaScript (javascript)
3. Test Your Changes by Rerunning
Save your file, then run dart run again. Your terminal output will update to this:
Building package executable...
Built cli:cli.
Hello, Dart!Code language: CSS (css)
This confirms your code edits took effect successfully.
Quick Recap of Core Concepts
dart create [project-name]: Generates a fully standardized Dart project template in one commanddart run: Compiles and launches your Dart application- The
bin/directory contains program entry points; themain()function marks the starting point of all Dart code execution pubspec.yamlis the central configuration file for Dart projects, used to manage dependencies and project metadata