Flutter - Installation
Flutter - Installation
Section titled “Flutter - Installation”This chapter guides you through installing the Flutter SDK and setting up your development environment on Windows, macOS, and Linux.
Important: System requirements and specific steps can change. Always refer to the official Flutter installation documentation for the most up-to-date instructions: https://docs.flutter.dev/get-started/install
General Requirements
Section titled “General Requirements”- Operating System: Windows 10 or later (64-bit), macOS (64-bit), Linux (64-bit).
- Disk Space: At least 1.64 GB (does not include IDEs/tools).
- Tools: Flutter depends on
gitbeing available in your environment.
Installation on Windows
Section titled “Installation on Windows”1. Get the Flutter SDK
Section titled “1. Get the Flutter SDK”- Go to the Flutter SDK releases page: https://docs.flutter.dev/get-started/install/windows
- Download the latest stable release bundle (a
.zipfile). - Extract the zip file to a permanent location on your computer where you want to keep Flutter (e.g.,
C:\src\flutter). Do not install Flutter in a directory likeC:\Program Files\that requires elevated privileges.
2. Update Your Path Environment Variable
Section titled “2. Update Your Path Environment Variable”- In the Windows Search bar, type ‘env’ and select
Edit the system environment variables. - Click the
Environment Variables...button. - Under
User variables, find thePathentry, select it, and clickEdit.... - Click
Newand add the full path to thebindirectory within your Flutter installation folder (e.g.,C:\src\flutter\bin). - Click
OKon all dialog windows to save the changes. - Important: Close and reopen any existing Command Prompt or PowerShell windows for the path change to take effect.
3. Run Flutter Doctor
Section titled “3. Run Flutter Doctor”- Open a new Command Prompt or PowerShell window.
- Run the command:
flutter doctor flutter doctorchecks your environment and displays a report of the status of your Flutter installation. It will identify missing dependencies or further setup required.- Example Output (may vary):
4. Install Android Studio (for Android Development)
Section titled “4. Install Android Studio (for Android Development)”- Download and install Android Studio from the official Android Developers site.
- During setup, ensure you install the Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools.
flutter doctorwill guide you if components are missing.
5. Set up Android Device / Emulator
Section titled “5. Set up Android Device / Emulator”- Emulator: Use the Android Studio AVD Manager (Tools > AVD Manager) to create and launch an Android Virtual Device.
- Physical Device: Enable Developer options and USB debugging on your Android phone, then connect it via USB. Follow prompts on the device and computer to authorize.
- Run
flutter doctoragain to verify device connection.
6. Install Flutter and Dart Plugins
Section titled “6. Install Flutter and Dart Plugins”- Open Android Studio.
- Go to
File>Settings>Plugins(orAndroid Studio>Preferences...>Pluginson older versions). - Search for
Flutterin the Marketplace tab and clickInstall. - Accept the prompt to install the required
Dartplugin as well. - Restart Android Studio when prompted.
Installation on macOS
Section titled “Installation on macOS”1. Get the Flutter SDK
Section titled “1. Get the Flutter SDK”- Go to the Flutter SDK releases page: https://docs.flutter.dev/get-started/install/macos
- Download the latest stable release bundle for your Mac’s architecture (Intel or Apple Silicon).
- Extract the zip file to a permanent location (e.g.,
$HOME/development/flutter). - Alternatively, you can clone the repository:
git clone https://github.com/flutter/flutter.git -b stable
2. Update Your Path Environment Variable
Section titled “2. Update Your Path Environment Variable”- Open or create your shell’s configuration file (e.g.,
$HOME/.zshrcfor Zsh (default on newer macOS),$HOME/.bash_profilefor Bash). - Add the following line, replacing
[PATH_TO_FLUTTER_GIT_DIRECTORY]with the actual path to your Flutter directory: export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"- Save the file.
- Run
source $HOME/.<your_config_file>(e.g.,source $HOME/.zshrc) or open a new terminal window for the changes to take effect. - Verify the path:
echo $PATH(should include the flutter/bin path) andwhich flutter.
3. Run Flutter Doctor
Section titled “3. Run Flutter Doctor”- Open a new Terminal window.
- Run the command:
flutter doctor - Review the output for any missing dependencies.
- Example Output (may vary):
4. Install Xcode (for iOS/macOS Development)
Section titled “4. Install Xcode (for iOS/macOS Development)”- Install Xcode from the Mac App Store.
- Open Xcode once after installation and accept the license agreement.
- Install the Xcode command-line tools:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developerandsudo xcodebuild -runFirstLaunch. - Run
flutter doctoragain to ensure Xcode setup is complete.
5. Set up iOS Simulator / Device
Section titled “5. Set up iOS Simulator / Device”- Simulator: Open the simulator via Xcode (
Xcode>Open Developer Tool>Simulator) or using the commandopen -a Simulator. - Physical Device: Connect your iOS device via USB. You may need to configure code signing in Xcode to deploy to a physical device (requires an Apple Developer account).
6. Install Android Studio and Plugins (Optional, for Android Development)
Section titled “6. Install Android Studio and Plugins (Optional, for Android Development)”- Follow steps 4 & 6 from the Windows installation section if you also plan to develop for Android.
Installation on Linux
Section titled “Installation on Linux”1. Get the Flutter SDK
Section titled “1. Get the Flutter SDK”- Go to the Flutter SDK releases page: https://docs.flutter.dev/get-started/install/linux
- Download the latest stable release bundle (
.tar.xz). - Extract the file in a desired location:
tar xf flutter_linux_*.tar.xz -C $HOME/development(replace path as needed). - Alternatively, use
snapd:sudo snap install flutter --classic(this also handles the path setup).
2. Update Your Path (if not using Snap)
Section titled “2. Update Your Path (if not using Snap)”- Open your shell’s configuration file (e.g.,
$HOME/.bashrcor$HOME/.zshrc). - Add the following line:
export PATH="$PATH:[PATH_TO_FLUTTER_DIRECTORY]/flutter/bin" - Run
source $HOME/.<your_config_file>or open a new terminal. - Verify:
which flutter.
3. Install Dependencies
Section titled “3. Install Dependencies”- Flutter requires several command-line tools. Run
flutter doctorand install any missing dependencies reported. Common ones includebash,curl,file,git,unzip,which,xz-utils,zip, and libraries likelibGLU.so.1. - Use your distribution’s package manager (e.g.,
apt,dnf) to install them. Example for Debian/Ubuntu: sudo apt update && sudo apt install -y bash curl file git unzip which xz-utils zip libglu1-mesh
4. Run Flutter Doctor
Section titled “4. Run Flutter Doctor”- Run
flutter doctorin a terminal. - Address any issues reported, especially for Android Studio, Android toolchain, or connected devices.
5. Install Android Studio and Set up Devices
Section titled “5. Install Android Studio and Set up Devices”- Follow steps 4, 5, & 6 from the Windows installation section.
Next Steps
Section titled “Next Steps”Once flutter doctor shows no major issues (or issues only for platforms you don’t intend to target), your environment is ready. You can proceed to create your first Flutter application!