This page is a supporting reference, not a replacement for the lessons. Return whenever you need to interpret a diagnostic, choose a command, or recall a concept. Examples assume a terminal opened at the project root, where pubspec.yaml lives.

In this reference: reading commands · Flutter diagnostics · creation and execution · dependencies · quality and tests · build · Dart tools · Dart glossary · Flutter glossary · diagnostic workflow.

How to read a command

In flutter run -d <deviceId> --debug:

  • flutter is the executable.
  • run is the subcommand.
  • -d is a short option.
  • <deviceId> is a value you replace; don’t type the angle brackets.
  • --debug is a flag whose presence selects behavior.

Use flutter help <command> or dart help <command> to inspect help installed with your version. Online documentation evolves, while the local executable knows exactly which options that installation supports.

Flutter environment and diagnostics

Environment flutter --version

Purpose. Reports Flutter framework, engine, Dart SDK, and related tool versions.

When to use it. At project start, in failure reports, and before comparing results across developer machines or CI.

What to record. Channel, Flutter version, and Dart version. A reproducible application declares its toolchain, not only package dependencies.

Diagnostics flutter doctor

Purpose. Inspects the installation and checks whether toolchains for known targets are available. It can evaluate Flutter SDK, Android SDK, Xcode on macOS, browsers, IDEs, and devices.

How to read it. means a check passed; ! calls for attention or indicates incomplete setup; marks a failure. An iOS warning does not block a course targeting only Android and web.

Useful variant. flutter doctor -v shows paths, versions, and details that help uncover duplicate SDKs or a wrong environment variable.

What it doesn’t do. It does not install or automatically fix every dependency. Interpret diagnostics against the platforms you actually intend to ship.

Practice. Run the verbose form and classify every non- result as target blocker, optional improvement, or irrelevant for now.

Configuration flutter config

Purpose. Displays or changes persistent Flutter CLI configuration, including platform enablement and paths supported by the installed version.

Caution. Global configuration affects other projects on the machine. Run flutter config without arguments and record the previous state before changing it.

Devices flutter devices

Purpose. Lists connected targets Flutter can use, including name, identifier, and platform.

Common use. Copy an identifier and run flutter run -d <deviceId>. If a device is missing, verify connection, authorization, drivers, USB debugging, or browser availability.

Emulators flutter emulators

Purpose. Lists configured emulators and can start one through flutter emulators --launch <emulatorId>.

Important distinction. An emulator is a registered virtual environment; a device is a target currently available to run. After launch, confirm it with flutter devices.

Project creation and execution

Project flutter create sales_management

Purpose. Generates a Flutter application structure and resolves dependencies by default.

What to inspect. pubspec.yaml, lib/main.dart, test/, and platform folders. Shared code does not remove native integration points.

Decision. Read flutter create --help before choosing platforms, organization identifier, or template. Changing package identifiers later can affect signing, Firebase, and publishing.

Expected output. The directory is created, dependencies resolve, and the CLI prints next steps. Read the output instead of treating it as noise.

Execution flutter run -d <deviceId>

Purpose. Builds and runs the application on a device while keeping a development session attached.

Default mode. It generally runs in debug with asserts, VM service, and Hot Reload. This mode favors diagnosis; it does not represent production performance or size.

During the session. r requests Hot Reload, R requests Hot Restart, and q quits. Hot Reload injects updated code and rebuilds the tree but might not reapply initializers or native changes.

Common failure. Multiple available devices without explicit selection. Use flutter devices and -d to make the target predictable.

Debugging flutter attach

Purpose. Connects Flutter tools to an engine already running. This helps in add-to-app scenarios or when the native host started the application.

Don’t confuse them. run starts and follows an app; attach finds an existing execution.

Dependencies and generation

Packages flutter pub get

Purpose. Resolves pubspec.yaml constraints, downloads missing packages, and materializes the resolution in a lockfile where appropriate.

When to run it. After changing dependencies or checking out a revision whose lockfile changed. For Flutter apps, prefer flutter pub over dart pub because the Flutter CLI includes Flutter SDK constraints.

Don’t confuse them. get honors the available resolution and lockfile; upgrade searches for newer versions allowed by constraints and can change the lockfile.

Packages flutter pub add <package>

Purpose. Adds a dependency to pubspec.yaml and resolves packages.

Before adding it. Review maintenance, supported platforms, license, security history, API, and integration cost. Popularity is not technical evaluation.

Packages flutter pub outdated

Purpose. Compares current, upgradable, resolvable, and latest versions. It separates “a new release exists” from “current constraints can accept it.”

Responsible use. Update in small groups, read changelogs, and run analysis, tests, and a smoke test. An updated package does not mean a validated application.

Generation flutter gen-l10n

Purpose. Generates localization classes from project configuration and ARB files.

Common failure. Missing keys, incompatible placeholders across languages, or divergent configuration. Never hand-edit generated files; fix the source and generate again.

Quality and tests

Quality flutter analyze

Purpose. Runs static analysis through the Dart analyzer and analysis_options.yaml. It finds type errors, invalid usage, warnings, and lints without running the app.

How to read it. Inspect file, line, severity, diagnostic code, and message. Fix the cause; don’t silence a rule only to make CI green.

Limit. Static analysis does not prove behavior, integration, or experience. It complements tests and review.

Tests flutter test

Purpose. Runs Dart and Flutter tests in the package. It can receive a file, directory, name, and platform options.

Variants. flutter test --coverage produces coverage data; flutter test test/products/ narrows the loop during development.

Expected output. Test count and final result. A flaky test remains a failure: repeating it until green does not fix the cause.

Diagnostics flutter logs

Purpose. Follows logs from Flutter applications on connected devices.

Caution. Logs can expose personal data, tokens, and payloads. Redaction belongs in code; clearing a terminal does not remove exposure from remote observability.

Build and distribution

Build flutter build <target> --release

Purpose. Produces an artifact for a target such as appbundle, apk, ipa, web, windows, macos, or linux when supported by host and project.

Release is not publishing. The command creates artifacts; signing, distribution, store review, rollout, and post-release observation are separate stages.

Before building. Confirm environment, configuration, version, signing, secrets, analysis, and tests. Record the produced artifact path and hash.

Distribution flutter install -d <deviceId>

Purpose. Installs a Flutter app on a connected device. It helps validate an artifact or a run closer to distribution.

Limit. Successful installation does not prove startup, migration, sign-in, or critical journeys; run a smoke test afterward.

Maintenance flutter clean

Purpose. Removes build output and build-system generated files to force reconstruction.

When to use it. When evidence points to stale cache or inconsistent intermediate artifacts, especially after deep toolchain or native configuration changes.

When to avoid it. Don’t make clean the first response to every error. It slows the next build and can hide a problem you still don’t understand.

Toolchain flutter upgrade

Purpose. Updates Flutter SDK on the current channel.

Caution. The toolchain is a project dependency. Upgrade through a controlled change, read release notes, record versions, and run full validation. Don’t silently upgrade midway through diagnosis.

Dart tools

Flutter SDK includes Dart SDK. Use dart for language and Dart-package operations; use flutter when an operation depends on the framework or a Flutter application.

Dart dart run [file|package]

Runs a Dart program, project script, or executable supplied by a dependency. Arguments after the target reach main(List<String> args).

Use --enable-asserts when you need asserts in a context that doesn’t enable them by default. To observe a command-line program with DevTools, explore dart run --observe.

Dart dart format .

Formats files through the official formatter. Formatting removes style debates; it does not replace code review.

In CI, dart format --output=none --set-exit-if-changed . checks without rewriting and fails when it finds drift.

Dart dart analyze

Analyzes a Dart package without Flutter UI dependencies. This is useful for course domain packages and tooling.

dart analyze and flutter analyze share the analyzer, but the Flutter command prepares a Flutter application context.

Dart dart fix --dry-run

Shows automated fixes available for diagnostics and known migrations. Review the proposal before running dart fix --apply.

Automated fixes do not understand business intent. Review the diff and run tests afterward.

Dart dart test

Runs tests in a Dart package. Use it to validate domain logic, utilities, and code that doesn’t need Flutter loaded.

Prefer small, deterministic tests. Network, clock, and randomness should be controlled through replaceable dependencies.

Dart dart doc

Generates API documentation from public libraries and documentation comments. Warnings reveal broken references or poorly documented APIs.

Documenting everything is not the goal; document contracts, decisions, limits, and behavior names don’t make obvious.

Dart dart compile <format> <file>

Compiles Dart programs to supported formats such as native executable, AOT snapshot, kernel, or JavaScript, depending on platform and version.

Choose the format for the runtime environment. AOT artifacts favor startup and distribution; JIT execution favors development and diagnosis.

Dart language glossary

TermOperational meaning
SDKToolchain containing compilers, runtime, libraries, and commands. Flutter SDK includes a compatible Dart SDK.
VMVirtual machine used by Dart in scenarios such as development, with debugging services and JIT.
JITCompilation during execution, suited to a fast development loop and Hot Reload.
AOTAhead-of-time compilation into an optimized artifact for supported production builds.
Null safetyType system that distinguishes nullable from non-nullable values and moves many failures into analysis or compilation.
FutureA value or error that becomes available once in the future. await suspends the async function; it doesn’t block the UI.
StreamAn asynchronous sequence of zero or more data, error, and completion events. It needs subscription and cancellation policy.
IsolateIsolated memory and execution unit. Isolates don’t share mutable objects; they communicate through messages.
Event loopProcesses events and microtasks in an isolate. Long synchronous work can still block UI responsiveness.
MixinReuses implementation across compatible hierarchies without multiple inheritance of state.
ExtensionAdds statically resolved APIs to existing types without changing their original definition.
Sealed classRestricts known subtypes and improves state modeling and exhaustive pattern matching.
Pattern matchingDeconstructs and validates structures through patterns, reducing casts and fragile conditionals.
PackageDart unit with pubspec.yaml, libraries, dependencies, and directory conventions.
PluginPackage that also integrates platform-specific implementations.

Flutter glossary

TermOperational meaning
WidgetImmutable description of part of the interface for a configuration and state.
ElementInstance connecting widgets to their place in the tree and preserving identity across rebuilds.
RenderObjectPerforms layout, painting, and hit testing for widgets involved in rendering.
BuildContextReference to an element’s location in the tree, used to resolve dependencies and ancestors at that point.
ConstraintsSize limits passed from parent to child; the child chooses an allowed size and the parent positions it.
StateInformation that changes over time and affects interface or behavior.
Hot ReloadInjects updated code and rebuilds the tree while preserving state when possible.
Hot RestartRestarts Dart code and loses in-memory state without necessarily reinstalling the app.
Full restartStops and starts the entire application, required for native and deep initialization changes.
Debug/Profile/ReleaseModes with different purposes: rapid diagnosis, performance measurement, and optimized distribution.
DevToolsInspector, debugger, performance, memory, network, and logging tools, depending on platform.
SemanticsInformation that makes an interface understandable to assistive technology and automation.

Diagnostic workflow

When something fails, avoid the automatic “clean and try again” sequence. Instead:

  1. Read the first relevant cause, not only the last line.
  2. Record command, directory, version, and target.
  3. Run flutter doctor -v when the environment is involved.
  4. Reduce the case to one test, device, or feature.
  5. Classify the failure as code, dependency, toolchain, platform, or credential.
  6. Change one variable at a time and record the result.
  7. After the fix, repeat the failing path and the complete gate appropriate to the risk.

Official sources