Project & Tooling
pubspec.yaml: the manifest
Section titled “pubspec.yaml: the manifest”Every Flutter project is described by pubspec.yaml — dependencies, dev-only dependencies, and the assets bundled into the app.
name: my_appenvironment: 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 fileThe 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 CLI
Section titled “The flutter CLI”The flutter command is the entry point to everything:
flutter create my_app # scaffold a new projectflutter pub get # resolve and download dependenciesflutter run # run on a connected device/emulatorflutter run --release # run in release modeflutter build apk # produce a release buildflutter doctor # diagnose your local toolchainflutter analyze # static analysis / lintsflutter 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
Section titled “DevTools”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.
Hot reload vs hot restart
Section titled “Hot reload vs hot restart”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 frommain()— 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.