Dart Environment
This lesson shows how to install a professional local Dart environment, verify tooling, and use AI as a setup copilot without losing architecture control.
Local Install
Install Dart SDK from the official distribution channel for your operating system. Prefer stable channel for production work.
- Install Dart SDK from dart.dev/get-dart.
- Open a new terminal and verify the installation.
- Pin the SDK version in project docs so the team uses the same runtime.
dart --version
dart --disable-analytics
dart --enable-analytics
Editor Setup
Use VS Code with the Dart extension and configure formatting/linting early so coding standards are enforced from day one.
- Install Dart extension in VS Code.
- Enable format on save.
- Use analyzer diagnostics to catch issues before runtime.
# analysis_options.yaml
include: package:lints/recommended.yaml
linter:
rules:
- always_declare_return_types
- avoid_print
- prefer_final_locals
Project Bootstrap
Create either a CLI project or a web project template, then run test and analyze immediately.
# CLI app
dart create -t console-full dart_cli_app
cd dart_cli_app
dart pub get
dart analyze
dart test
# Web app
dart create -t web dart_web_app
AI Setup Workflow
Use AI for acceleration, not authority. Ask for deterministic outputs and verify every generated step.
High-Value Prompts
- "Generate a Dart project setup checklist for Windows/macOS/Linux with SDK verification commands."
- "Create an analysis_options.yaml for a production Dart CLI app using recommended lints."
- "Propose a folder structure for domain, application, and infrastructure layers in a Dart backend."
Guardrails
- Require AI responses to include exact commands and expected output.
- Run
dart analyzeanddart testafter AI-generated edits. - Reject generated dependencies that are unmaintained or undocumented.
Setup Lab
- Install Dart SDK and verify
dart --version. - Create one CLI app and one web app.
- Add lints and fix all analyzer warnings.
- Write one passing unit test for each project.