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:
flutteris the executable.runis the subcommand.-dis a short option.<deviceId>is a value you replace; don’t type the angle brackets.--debugis 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
flutter --versionPurpose. 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.
flutter doctorPurpose. 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.
flutter configPurpose. 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.
flutter devicesPurpose. 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.
flutter emulatorsPurpose. 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
flutter create sales_managementPurpose. 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.
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.
flutter attachPurpose. 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
flutter pub getPurpose. 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.
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.
flutter pub outdatedPurpose. 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.
flutter gen-l10nPurpose. 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
flutter analyzePurpose. 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.
flutter testPurpose. 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.
flutter logsPurpose. 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
flutter build <target> --releasePurpose. 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.
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.
flutter cleanPurpose. 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.
flutter upgradePurpose. 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 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 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 analyzeAnalyzes 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 fix --dry-runShows 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 testRuns 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 docGenerates 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 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
| Term | Operational meaning |
|---|---|
| SDK | Toolchain containing compilers, runtime, libraries, and commands. Flutter SDK includes a compatible Dart SDK. |
| VM | Virtual machine used by Dart in scenarios such as development, with debugging services and JIT. |
| JIT | Compilation during execution, suited to a fast development loop and Hot Reload. |
| AOT | Ahead-of-time compilation into an optimized artifact for supported production builds. |
| Null safety | Type system that distinguishes nullable from non-nullable values and moves many failures into analysis or compilation. |
| Future | A value or error that becomes available once in the future. await suspends the async function; it doesn’t block the UI. |
| Stream | An asynchronous sequence of zero or more data, error, and completion events. It needs subscription and cancellation policy. |
| Isolate | Isolated memory and execution unit. Isolates don’t share mutable objects; they communicate through messages. |
| Event loop | Processes events and microtasks in an isolate. Long synchronous work can still block UI responsiveness. |
| Mixin | Reuses implementation across compatible hierarchies without multiple inheritance of state. |
| Extension | Adds statically resolved APIs to existing types without changing their original definition. |
| Sealed class | Restricts known subtypes and improves state modeling and exhaustive pattern matching. |
| Pattern matching | Deconstructs and validates structures through patterns, reducing casts and fragile conditionals. |
| Package | Dart unit with pubspec.yaml, libraries, dependencies, and directory conventions. |
| Plugin | Package that also integrates platform-specific implementations. |
Flutter glossary
| Term | Operational meaning |
|---|---|
| Widget | Immutable description of part of the interface for a configuration and state. |
| Element | Instance connecting widgets to their place in the tree and preserving identity across rebuilds. |
| RenderObject | Performs layout, painting, and hit testing for widgets involved in rendering. |
| BuildContext | Reference to an element’s location in the tree, used to resolve dependencies and ancestors at that point. |
| Constraints | Size limits passed from parent to child; the child chooses an allowed size and the parent positions it. |
| State | Information that changes over time and affects interface or behavior. |
| Hot Reload | Injects updated code and rebuilds the tree while preserving state when possible. |
| Hot Restart | Restarts Dart code and loses in-memory state without necessarily reinstalling the app. |
| Full restart | Stops and starts the entire application, required for native and deep initialization changes. |
| Debug/Profile/Release | Modes with different purposes: rapid diagnosis, performance measurement, and optimized distribution. |
| DevTools | Inspector, debugger, performance, memory, network, and logging tools, depending on platform. |
| Semantics | Information that makes an interface understandable to assistive technology and automation. |
Diagnostic workflow
When something fails, avoid the automatic “clean and try again” sequence. Instead:
- Read the first relevant cause, not only the last line.
- Record command, directory, version, and target.
- Run
flutter doctor -vwhen the environment is involved. - Reduce the case to one test, device, or feature.
- Classify the failure as code, dependency, toolchain, platform, or credential.
- Change one variable at a time and record the result.
- After the fix, repeat the failing path and the complete gate appropriate to the risk.