2. Setting Up a Development Environment
Note: In the following steps, we’ll use the VSCode tool to test the Dart scripts. Open two VSCode windows and use [File / Open Folder] to open the folders for both projects.
The TypeScript course installs Node.js, an npm project ([package.json]), TypeScript itself and its type checker ([tsc]), a script runner that does not require prior compilation ([tsx]), and finally ESLint. The Dart equivalent of this entire toolchain consists of a single component to install: [Dart SDK]—which can be downloaded from [dart.dev] or, more simply, installed via a system package manager ([choco install dart-sdk] on Windows, [brew install dart] on macOS, or the official APT repository on Linux/Debian/Ubuntu).
Whereas TypeScript requires three separate tools (the [tsc] compiler to check types, [tsx] to run a script without compiling it first, and ESLint for style analysis), the Dart SDK provides all of this in a single command, [dart], which includes the following subcommands: [dart run] (runs a script), [dart analyze] (checks the style—the combined equivalent of [tsc] and ESLint), [dart pub] (manages dependencies, equivalent to [npm]), [dart format] (reformats the code, equivalent to Prettier) and [dart test] (runs the tests).
2.1. Verifying Installed Tools
Once SDK is installed, verify the installation in a terminal using VSCode:
PS C:\Data\st-2026\dev\dart\dart-sept-2026-scripts\dart-fundamentals> dart --version
Dart SDK version: 3.12.2 (stable) (Tue Jun 9 01:11:39 2026 -0700) on "windows_x64"
which displays the version of SDK (for example, [Dart SDK version: 3.12.2 (stable)]). Unlike Node.js and TypeScript, which are installed separately (one version of Node, one version of TypeScript), the version number of the Dart SDK covers the language, the compiler, and all the tools controlled by [dart]: there is only one version to track.
2.2. Setting up the VSCode project
As with TypeScript, create a project folder and open it in VSCode. Whereas a TypeScript project is declared with two files ([package.json] for dependencies, [tsconfig.json] for compiler options), a Dart project requires only one: [pubspec.yaml].
2.2.1. The pubspec.yaml file
[pubspec.yaml] serves both the role of [package.json] (project name, dependencies) and, to a lesser extent, that of [tsconfig.json] (the key [environment: sdk:] sets the range of accepted Dart SDK versions, much like [target]/[lib] define the version of ECMAScript targeted by [tsc]):
Unlike [package.json] (in JSON format), [pubspec.yaml] is, strictly speaking, a YAML file—indentation is significant in it, just as it is in Python.
Once this file is written, the command [dart pub get] (equivalent to [npm install]) downloads the declared dependencies and generates a [pubspec.lock] file (equivalent to [package-lock.json]), which locks in the exact versions to be installed.
2.3. First script
A minimal Dart script, [hello.dart]:
is run with:
Two immediate differences from the first script, TypeScript, in the course: the function [main] is here MANDATORY (an executable Dart script must define a function named [main] at the file level—unlike TypeScript/[tsx], where the top-level code in the file runs directly, without requiring a function to be defined); and [dart run] compiles and executes the script in a single step, without a visible separate transpilation step (like [tsx], but without the need to install any additional tools: [dart run] is part of SDK itself).
2.4. Second script: static analysis
Whereas the TypeScript course distinguishes between a “type checking” step ([tsc --noEmit]) and a separate ESLint step, Dart merges the two into a single command:
When run without arguments from the root of a project containing a [pubspec.yaml] file, it analyzes all [.dart] files in the project: it flags both type errors (the equivalent of [tsc]) and style issues covered by the enabled lint rules (the equivalent of ESLint)—see the following section for information on enabling these rules.
2.5. The linter
ESLint is an external tool that must be installed and configured separately (file [eslint.config.js], selecting a preset, etc.). Dart integrates its own linter directly into [dart analyze]: simply add the official [package:lints] package to the [dev_dependencies] of [pubspec.yaml], then create a [analysis_options.yaml] file at the root of the project:
This single file serves the same purpose as [eslint.config.js] for the TypeScript course: it activates a set of rules recommended by the Dart team (unused variables, suspicious comparisons, preference for [const], etc.), which [dart analyze] then applies automatically.
2.6. VSCode Dart Extension
The official [Dart] extension (publisher: Dart Code), installed from the VSCode extension marketplace, serves exactly the same purpose as the ESLint extension from the TypeScript course, but is more comprehensive: syntax highlighting, autocompletion, display of [dart analyze] errors directly in the editor, and running scripts (the [Run]/[Debug] button above each [main] function) without exiting VSCode. Installing this single extension is sufficient to cover what the TypeScript course spreads across multiple extensions.