To install and run Flutter, your development environment must meet the minimum requirements
- Select the operating system on which you are installing Flutter
Windows | macOS | Linux | ChromeOS |
---|
-
Download the installation bundle to get the latest stable release of the Flutter SDK
-
Extract the file in the desired location
If you don’t want to install a fixed version of the installation bundle, you can get the source code from the Flutter repo on GitHub with the following command:
Windows:
$ git clone https://github.com/flutter/flutter.git -b stable
macOS / Linux / ChromeOS:
$ git clone https://github.com/flutter/flutter.git
You can also change branches or tags as needed. For example, to get just the stable version:
$ git clone https://github.com/flutter/flutter.git -b stable --depth 1
- macOS / Linux / ChromeOS
- export PATH="$PATH:`pwd`/flutter/bin"
This command sets your PATH variable for the current terminal window only. To permanently add Flutter to your path, see Update your path
In some cases, your distribution may not permanently acquire the path when using the above directions. When this occurs, you can change the environment variables file directly. These instructions require administrator privileges:
-
Determine the directory where you placed the Flutter SDK
-
Locate the
etc
directory at the root of the system, and open theprofile
file with root privileges
$ sudo nano /etc/profile
Tip: Locate the .bash_profile
and if you don't see it, just show the hidden files or you can crete your own to add Flutter to the path
$ touch .bash_profile
You have to close and reopen any existing console windows for these changes to take effect
Run the following command to see if there are any dependencies you need to install to complete the setup (for verbose output, add the -v flag):
$ flutter doctor
This command checks your environment and displays a report to the terminal window
To run Flutter commands, take these steps to add Flutter to the PATH environment variable
You can update your PATH variable for the current session at the command line, as shown in Get the Flutter SDK. You’ll probably want to update this variable permanently, so you can run flutter
commands in any terminal session.
- Windows
- If the entry exists, append the full path to `flutter\bin` using `;` as a separator from existing values
- If the entry doesn’t exist, create a new user variable named Path with the full path to `flutter\bin` as its value
- macOS / Linux / ChromeOS
- The steps for modifying this variable permanently for all terminal sessions are machine-specific. Typically you add a line to a file that is executed whenever you open a new window.
For example:
- Determine the directory where you placed the Flutter SDK. You need this in Step 1.3.
- Open (or create) the rc file for your shell. For example, Linux uses the Bash shell by default, so edit
$HOME/.bashrc
. If you are using a different shell, the file path and filename will be different on your machine. - Add the following line and change
[PATH_TO_FLUTTER_GIT_DIRECTORY]
to be the path where you cloned Flutter’s git repo:
$ export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin" >> ~/.profile
- Run
source $HOME/.<rc file>
to refresh the current window, or open a new terminal window to automatically source the file. - Verify that the
flutter/bin
directory is now in your PATH by running:
$ echo $PATH
- Verify that the flutter command is available by running
$ which flutter
macOS supports developing Flutter apps in iOS, Android, and the web (technical preview release). Complete at least one of the platform setup steps now, to be able to build and run your first Flutter app
-
Install the latest stable version of Xcode (using web download or the Mac App Store)
-
Configure the Xcode command-line tools to use the newly-installed version of Xcode by running the following from the command line:
$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
$ sudo xcodebuild -runFirstLaunch
- Make sure the Xcode license agreement is signed by either opening Xcode once and confirming or running
sudo xcodebuild -license
from the command line
To prepare to run and test your Flutter app on the iOS simulator, follow these steps
$ open -a Simulator
Make sure your simulator is using a 64-bit device (iPhone 5s or later) by checking the settings in the simulator’s Hardware > Device menu.
- Android Studio offers a complete, integrated IDE experience for Flutter
- To prepare to run and test your Flutter app on an Android device, you need an Android device running Android 4.1 (API level 16) or higher
- For details on the above steps, see Managing AVDs
Add an editor plugin for Android Studio, IntelliJ, VS Code, or Emacs. If you want to use a different editor, that’s OK
- Alternatively, you can also use IntelliJ IDEA Community or Ultimate
VS Code is a lightweight editor with Flutter app execution and debug support
- VS Code, latest stable version
- You should now be setup to start editing the
lib/main.dart
file and build your app
Select your development tool of choice for writing, building, and running Flutter apps
This steps describes how to create a new Flutter app from templates & run it
Use the flutter create
command to create a new project:
$ flutter create myapp
$ cd myapp
Check that an Android device is running. If none are shown, follow the device-specific instructions on the Install page for your OS
$ flutter devices
Run the app with the following command:
$ flutter run