The purpose of this chapter is to help the reader install a development environment on their computer suitable for Flutter applications written with Dart.
Developing on a PC for iOSYou can develop Flutter applications on a PC and you will have no problems at all until you want to run your code on an Apple iOS device, like an iPhone or an iPad. Apple has made compiling of iOS
applications exclusively available to macOS using their XCode tool.
It’s Not as Bad as it SeemsFlutter really works well from a cross-platform point of view and you can do 90% of the development on a PC even if you are planning to deploy to iOS. You really can develop on one platform then run it on another and trust that it will almost completely work on the other.
When you get to testing and deployment you will have some options:
Buy, borrow or rent a Mac.
Install a Mac virtual machine on your PC using software like VMWare or Virtual Box.
Rent a Mac on the cloud for $20 a month using a service like www.macincloud.com.
Step 1: Software Pre-Requisites
One thing I noticed from installing Flutter was that nobody mentioned that Git was a pre-requisite for installing Flutter. So, ensure you have git installed before doing anything else.
If you are planning on installing Flutter on a Mac, it’s a good idea to install Brew first as the Flutter Doctor will ask you to use brew to install additional software when required.
XCode Command-Line Tools
If you are planning on installing Flutter on a Mac, you are definitely going to need these.
Step 2: Download the Flutter SDK
We mentioned the Flutter SDK earlier, how it has all the tools you need to perform basic Flutter development. However, it also has a very useful tool called Flutter Doctor that is used to setup your Flutter Development environment. Download this SDK and copy it into a
Note that the Flutter SDK also contains the Dart SDK.
Step 3: Setup Your Path
The Flutter SDK has command-line tools, including Flutter Doctor that need to be run from the command-line. These command-line tools reside in the ‘bin’ folder of the Flutter SDK. You need to include the bin folder (within the flutter SDK) in your computers path so that you can run the command-line tools from the command-line.
Step 4: Run Flutter Doctor
You will need to run the command below:
This will checkout your environment and diagnose (like your doctor) what is good and bad about your flutter development environment. It will provide you with a summary, complete with instructions on what you need to do.
Here are my notes from running the install on 3 platforms:
Just follow the instructions. Some of them are very simple, like saying ‘yes’ to licenses. Some are more involved.
You might get a message about installing the missing Android SDK. This can be remedied by installing Android Studio then running it, as the first thing it will do is setup the Android SDK.
If you are installing Flutter on a Mac (or Unix) rather than on a PC then there are many more dependencies (for iOS compilation, deployment etc.) and it can take much longer.
Step 5: Setup Your Editor
Flutter Doctor Tells You to Install the Android Studio Editor If you have followed the flutter doctor instructions, you should already have installed Android Studio. This is what the official Flutter website says:
Note: Flutter relies on a full installation of Android Studio to supply its Android platform dependencies.
So, you should already have the Android Studio editor installed by the time you have got past the flutter doctor. Android Studio is the official IDE for android application development as it provides a very comprehensive, well-supported (by Google) solution:
• It is a superb editor.
• It is also free to use.
• It also works (very well) for developing iOS applications in Flutter.
• It was based on IntelliJ IDEA so it works in a very similar manner.
Thus, the easiest way to get going with an editor is to install the Flutter plugins into Android Studio. Installing the Flutter plugins takes all of five minutes:
1. Start Android Studio.
2. Open plugin preferences (Preferences > Plugins on macOS, File
> Settings > Plugins on Windows & Linux).
3. Select Browse repositories, select the Flutter plugin and
4. Click Yes when prompted to install the Dart plugin.
5. Click Restart when prompted.
Step 6: Setup Your Emulator(s)
You will need to setup at least one emulator so you can run your code in the next chapter.
At this point we are talking about the Android Emulator, not the Apple one. We will cover the Apple Emulator later on! We will also cover how to get going with the real hardware, your phone.
Introduction to the Android Emulator
The Android Emulator simulates Android devices on your computer so that you can test your application on a variety of devices and Android API levels without needing to have each physical device.
The emulator provides almost all of the capabilities of a real Android device and it comes with predefined configurations for various Android phone, tablet, Wear OS, and Android TV devices.