Sub topic 2
Installing the Flutter SDK
This chapter assumes you can open a terminal, run commands, and read environment-variable instructions. Basic knowledge of variables, functions, and classes is useful, but you do not need Dart installed separately. The Flutter SDK includes the Dart SDK.
Flutter is a software development kit (SDK) for building applications from one codebase. It includes the flutter command-line tool, Dart, framework libraries, and tools for building and running apps.
Choose an installation method
Download Flutter from the official Flutter website. Choose the stable channel unless you need an unreleased feature. The stable channel is intended for normal application development.
| Platform | Main installation work | Common extra requirement |
|---|---|---|
| Windows | Extract the SDK and add its `bin` directory to `Path` | Windows desktop tools or Android tools |
| macOS | Download or clone the SDK and add `bin` to `PATH` | Xcode for iOS and macOS targets |
| Linux | Download or clone the SDK and add `bin` to `PATH` | Linux desktop build dependencies or Android tools |
Place the SDK in a directory that your user account can read and write. Avoid locations that require administrator permission. On Windows, a path such as C:\src\flutter is easier to use than a protected system directory. On macOS or Linux, a directory under your home folder is suitable.
Add Flutter to your path
Your PATH is a list of directories that your shell searches for executable commands. Add the Flutter SDK's bin directory to it. For example, if the SDK is in /Users/alex/development/flutter, add this directory:
/Users/alex/development/flutter/binAfter changing PATH, open a new terminal window. Existing terminals may still have the old value.
On macOS or Linux, a shell configuration file such as ~/.zshrc or ~/.bashrc usually contains the setting. On Windows, edit the user-level environment variables through System Settings. Do not add the full path to the flutter executable. Add the directory containing it.
Verify the SDK
Run these commands from a new terminal:
flutter --version
flutter doctor
flutter devicesflutter --version reports the installed Flutter and Dart versions. flutter doctor checks the SDK and related development tools. flutter devices lists targets that Flutter can use, such as a browser, emulator, simulator, desktop target, or connected phone.
A warning from flutter doctor does not always prevent every kind of development. For example, missing iOS tools matter for iOS builds but do not prevent you from running a web target. Read each diagnostic and install only the components needed for your target.
Resolve common setup problems
If the shell reports that flutter is not found, check the PATH entry, spelling, and terminal restart. If flutter doctor reports missing Android licenses, follow its suggested command to review and accept the licenses. If no device appears, install or start a target before running the app.
Exercise
Which command should you run first to diagnose a Flutter installation that appears incomplete?
Show answer
Run flutter doctor. It checks Flutter and related platform tools and reports the components that need attention.