Project Starters

Flutter Project Starter

From flutter doctor to hot-reloading an app on the emulator — the restart ritual for cross-platform mobile.

FlutterDartmobilecross-platform

Before you start

Flutter's own doctor tells you exactly what's missing — run it first, every time you come back:

flutter doctor

Fix what it flags. The usual ones: Android toolchain (install Android Studio), and licenses:

flutter doctor --android-licenses

You edit Flutter in VS Code (with the Flutter extension) or Android Studio — either works.

Create and run

flutter create my_app
cd my_app
flutter run

If more than one device is available, flutter run lists them — pick by id, or check first with:

flutter devices
flutter emulators --launch <emulator_id>

No emulator yet? Create one in Android Studio's Device Manager (see the Android starter) — Flutter uses the same ones. On Windows you can also run instantly with flutter run -d windows (desktop) or -d chrome (web) while the emulator boots.

The magic keys while it runs

  • r — hot reload: applies your code changes in ~1 second, keeps app state
  • R — hot restart: full restart when reload isn't enough (new state, changed main())
  • q — quit

The files that matter

  • lib/main.dart — everything starts here; the counter demo app is all in this one file
  • pubspec.yaml — dependencies, assets, fonts. The package.json of Flutter.
  • android/, ios/, web/, windows/ — platform shells; stay out until you need permissions or icons

Adding a package

flutter pub add http

That edits pubspec.yaml and fetches it. Browse packages at pub.dev.

Common gotchas

  • flutter not recognized: the SDK's bin folder isn't on PATH — re-run the install steps from docs.flutter.dev, then restart the terminal.
  • Stuck "Running Gradle task 'assembleDebug'..." forever: the first Android build genuinely takes minutes; after that it's fast. If it's broken rather than slow, flutter clean then rebuild.
  • Red screen of errors on the device: that's a Dart exception, not a build failure — read the console, hot reload after fixing.
  • Emulator runs but app targets Chrome: you picked the wrong device — flutter run -d <device_id>.