Sub topic 3
Checking Your Setup with `flutter doctor`
Prerequisites
Assume that you have downloaded the Flutter SDK and can open a terminal. You should also understand basic variables, functions, and classes. This chapter uses commands, but it does not require you to write Dart code.
Flutter depends on several tools. The SDK provides the flutter command, while each run target may need extra software. For example, Android development needs Android SDK tools, and iOS development needs Xcode on macOS. The flutter doctor command checks these parts and reports what is ready.
Run the diagnostic
Open a terminal and run:
flutter --version
flutter doctor
flutter devicesflutter --version confirms that the terminal can find Flutter and shows the installed version. flutter doctor checks the main development toolchain. flutter devices lists targets where Flutter can run an app.
A typical flutter doctor report contains rows such as these:
| Report marker | Meaning | Usual action |
|---|---|---|
| `[✓]` | The component passed its checks | No action |
| `[!]` | The component is usable but has a warning | Read the suggested fix |
| `[✗]` | A required component is missing or broken | Install or repair it |
The exact rows depend on your operating system and enabled platforms. You might see checks for Flutter, Android toolchains, Xcode, Chrome, connected devices, and the development environment.
Read the complete message after every warning or error. Flutter often prints the next command or a link to setup documentation. Fix the highest-level missing component first, then run flutter doctor again. A later error can disappear after an earlier toolchain problem is fixed.
For more detail, use:
flutter doctor -vThe -v option means verbose output. It prints paths and version details that help diagnose problems such as multiple Flutter installations or an SDK that is not on your PATH. PATH is the list of directories that your shell searches when you type a command.
Understand the dependency chain
A successful Flutter check does not guarantee that every target works. Flutter may be ready while Android, iOS, web, or desktop support is not. Select the platform you intend to use and resolve its specific warning.
Check a run target
flutter devices may show a browser, desktop target, emulator, simulator, or physical device. If it shows no devices, start an emulator or simulator, connect a physical device, or enable a supported desktop or web target.
You can ask Flutter to show available run targets with:
flutter emulatorsThis command lists configured Android emulators. An emulator is software that behaves like a mobile device. A simulator performs a similar role for some platforms, while a physical device is actual hardware connected to your computer.
Exercise
flutter doctor reports that Flutter is ready, but flutter devices lists no usable target. What should you check next?
Show answer
Start or connect a supported target, then run flutter devices again. For Android, check that an emulator is running or that a device is connected and authorized.