This episode is hands-on: installing the Dart SDK and verifying the version, running scripts with dart run and the dart repl REPL, creating a project with dart create, and adding your first dependency to pubspec.yaml.

In episode 2 you already understood Dart's architecture. Now it's time to get your hands on the terminal. Episode 3 is a full practice session: installing the Dart SDK, verifying the installation, running scripts, using the REPL, creating a project, and adding your first dependency.
This entire series will use the same commands, so make sure you follow these steps on your own machine. Don't hesitate to repeat them until the commands feel natural under your fingers.
The end goal of this episode is simple: you can create a new Dart project and add a package from pub.dev without looking at the documentation.
The Dart SDK can be installed in several ways:
apt.brew install dart.choco install dart-sdk, or download the zip from dart.dev.A universal alternative: download the Dart SDK archive directly from the official site and add the bin directory to your PATH. This gives you full control over the version.
After installation, verify that the command is recognized by your shell:
dart --versionThe output shows the SDK version and the target architecture, for example Dart SDK version: 3.5.4 (stable). If command not found appears, double-check your PATH and make sure the shell was restarted after installation. The command dart --version will be your first health check every time you set up a new environment.
The easiest way to execute code is to write a single file and run it:
void main() {
var pesan = 'Dart siap dipakai';
print(pesan);
}dart run hello.dartdart run hello.dart runs the script with the Dart VM. For a project, dart run without arguments executes the entry point registered in pubspec.yaml.
For quick experiments, use the REPL (Read-Eval-Print Loop):
dart replInside the REPL, you can type expressions and immediately see the results without creating a file. Type exit to leave. The REPL is very useful for testing syntax before adding it to a project.
For a real project, don't create files manually. Use the official scaffold:
dart create my_app
cd my_appThe command dart create my_app generates a console project with a standard structure: bin/ for the entry point, lib/ for importable code, and test/ for unit tests. Various templates are available, including package for libraries and server-shelf for backend applications.
Run the bundled project to make sure everything works:
dart runThe output shows the message from bin/my_app.dart. This structure is the foundation of every Dart project you'll encounter.
All project metadata lives in pubspec.yaml. This file declares the name, SDK environment, dependencies, and dev_dependencies:
name: my_app
description: Contoh project Dart.
version: 1.0.0
environment:
sdk: ^3.5.0
dependencies:
http: ^1.2.0
dev_dependencies:
lints: ^4.0.0
test: ^1.25.0In the example above, the http dependency is written with the caret version ^1.2.0, which means version 1.2.0 up to but not including 2.0.0. Dependencies are added in the dependencies block, while development tooling goes into dev_dependencies.
After editing pubspec.yaml, download the dependencies:
dart pub getThe command dart pub get downloads all dependencies and creates a pubspec.lock file that pins the exact versions. Re-run this command every time pubspec.yaml changes, and the downloads are stored in the .dart_tool/ directory.
Key takeaways:
dart --version after a fresh setup.dart run file_name.dart for a single script; dart run for a project entry point.dart repl for quick experiments without creating files.dart create scaffolds a standard project structure with bin, lib, and test.pubspec.yaml, then run dart pub get.In the next episode 4, we'll move into syntax and basic language features — variables with var, final, and const, control flow like if, switch, and loops, functions with optional parameters, and the List, Set, and Map collections. You'll start writing real Dart code.