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.

  1. Install Dart SDK from dart.dev/get-dart.
  2. Open a new terminal and verify the installation.
  3. 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

  1. "Generate a Dart project setup checklist for Windows/macOS/Linux with SDK verification commands."
  2. "Create an analysis_options.yaml for a production Dart CLI app using recommended lints."
  3. "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 analyze and dart test after AI-generated edits.
  • Reject generated dependencies that are unmaintained or undocumented.

Setup Lab

  1. Install Dart SDK and verify dart --version.
  2. Create one CLI app and one web app.
  3. Add lints and fix all analyzer warnings.
  4. Write one passing unit test for each project.