Get the Flutter SDK
If you don’t have snapd, you can install flutter using the following steps:
1. Download the following installation bundle to get the latest stable release of the Flutter SDK:
2. Extract the file in the desired location, for example:
3. Add the Flutter tool to your path:
You are now ready to run Flutter commands!
Run flutter doctor
Run the following command to see if there are any dependencies you need to install to complete the setup (for verbose output, add the
Downloading straight from GitHub instead of using an archive
This is only suggested for advanced use cases.
You can also use git directly instead of downloading the prepared archive. For example, to download the stable branch:
git clone https://github.com/flutter/flutter.git -b stable
Update your path, and run flutter Doctor. This will let you know if there are other dependencies you need to install to use Flutter.
If you have not used the archive, Flutter will download the binary upgrade required as required (if you have used the archive, included in the account). You may wish to download these binary upgrades first (for example, you may wish to do this when setting up hermetic construction sites, or if you only have network availability from time to time). To do so, use the following command:
Update your path
1. Determine the path of your clone of the Flutter SDK. You need this in Step 3.
2.Open (or create) the
rc file for your shell. Typing
echo $SHELL in your Terminal tells you which shell you’re using. If you’re using Bash, edit
$HOME/.bashrc. If you’re using Z shell, edit
$HOME/.zshrc. If you’re using a different shell, the file path and filename will be different on your machine.
3.Add the following line and change
[PATH_OF_FLUTTER_GIT_DIRECTORY] to be the path of your clone of the Flutter git repo:
source $HOME/.<rc file> to refresh the current window, or open a new terminal window to automatically source the file.
5. Verify that the
flutter/bin directory is now in your PATH by running:
Verify that the
flutter command is available by running:
To develop Flutter apps for iOS, you need a Mac with Xcode installed.
- 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
This is the correct path for most cases, when you want to use the latest version of Xcode. If you need to use a different version, specify that path instead.
- Make sure the Xcode license agreement is signed by either opening Xcode once and confirming or running
sudo xcodebuild -licensefrom the command line.
Set up the iOS simulator
To prepare to run and test your Flutter app on the iOS simulator, follow these steps:
- On your Mac, find the Simulator via Spotlight or by using the following command:
$ open -a Simulator
2. Make sure your simulator is using a 64-bit device (iPhone 5s or later). You can check the device by viewing the settings in the simulator’sHardware > Device or File > Open Simulator menus.
3. Depending on your development machine’s screen size, simulated high-screen-density iOS devices might overflow your screen. Grab the corner of the simulator and drag it to change the scale. You can also use the Window > Physical Size or Window > Pixel Accurate options if your computer’s resolution is high enough.
If you are using a version of Xcode older than 9.1, you should instead set the device scale in the Window > Scale menu.
Create and run a simple Flutter app
To create your first Flutter app and test your setup, follow these steps:
1.Create a new Flutter app by running the following from the command line:
$ flutter create my_app
my_app directory is created, containing Flutter’s starter app. Enter this directory:
$ cd my_app
3. To launch the app in the Simulator, ensure that the Simulator is running and enter:
$ flutter run
Additional macOS requirements
Enable Desktop Support
Perform the following command to enable desktop support at the command line:
flutter config --enable-macos-desktop
Install the Flutter and Dart plugins
- Start Android Studio.
- Open plugin preferences (Preferences > Plugins as of v18.104.22.168 or later).
- Select the Flutter plugin and click Install.
- Click Yes when prompted to install the Dart plugin.
- Click Restart when prompted.