Skip to content

Project & Tooling

Every Flutter project is described by pubspec.yaml — dependencies, dev-only dependencies, and the assets bundled into the app.

name: my_app
environment:
sdk: ^3.5.0
dependencies:
flutter:
sdk: flutter
go_router: ^14.0.0 # runtime dependency
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0 # only used during development/tests
flutter:
uses-material-design: true
assets:
- assets/images/ # a whole folder
- assets/config.json # a single file

The split matters: dependencies ship inside your app; dev_dependencies (test frameworks, linters, code generators) do not. Assets listed here are the only ones bundled — a missing entry is the usual cause of “asset not found.”

The flutter command is the entry point to everything:

Terminal window
flutter create my_app # scaffold a new project
flutter pub get # resolve and download dependencies
flutter run # run on a connected device/emulator
flutter run --release # run in release mode
flutter build apk # produce a release build
flutter doctor # diagnose your local toolchain
flutter analyze # static analysis / lints

flutter doctor is the first thing to run when anything is off — it checks the SDK, device toolchains, and IDE plugins and tells you exactly what’s missing.

DevTools is the browser-based suite for inspecting a running app: the widget inspector (tap a widget, see its tree and constraints), the performance/timeline view (find jank), the memory view, and the network view. It’s how you see the trees and pipeline the earlier modules described.

The two refresh commands are not the same, and knowing the difference saves real confusion:

  • Hot reload (r) injects changed source into the running app and rebuilds the widget tree — State is preserved. It’s sub-second and is the reason Flutter development feels fast.
  • Hot restart (R) throws away app state and restarts from main() — slower, but a clean slate.

Hot reload has limits. It re-runs build, but it does not re-run initState or a changed main(), and it can’t apply certain changes (new const evaluations, changes to enum/class shape, global variable initializers). When a change doesn’t seem to take, the answer is usually hot restart.

What is the difference between `dependencies` and `dev_dependencies` in pubspec.yaml?
What does hot reload preserve that hot restart does not?
Why might a code change not appear after a hot reload?
What is the first command to run when your local toolchain seems broken?