We start our journey with Flutter from the basics: let’s install the environment together.
I deal with mobile applications in iOS, so let’s see how to use Flutter together with XCode.
Since Google provides us with a very detailed guide, we start with that: we can find it here (https://flutter.io/docs/get-started/install/macos).
First of all, we download the indicated package and unzip it.
Once you have done this step and exported the environment variable, we run the command:
flutter doctor
This command will tell us which dependencies we lack to be able to start using Flutter and also the relative steps to complete the operations: comfortable, no?
Not so convenient for iOS
If we do not remember, Flutter allows us to model graphical interfaces thanks to Dart, a language that is Google’s own. However, Dart is not present on any computer and is not yet a standard so we will have to manually configure the whole environment to be able to use.
We add that on OSX some tools must be installed through Homebrew, a package management system that allows us to install software. For those who know the Linux world, it is a kind of apt (if we talk about Ubuntu) or of yum (if we are talking about other distributions). For those who are a little ‘fasting these things as geeks: these tools allow us to install additional packages (read programs) that otherwise are not present in the common installations of our operating systems.
If we want to use Flutter to write our interfaces for iOS, we need to arm ourselves with patience and install Homebrew, its dependencies and, subsequently, the packages we need to hook Flutter to our dear XCode.
Easy easy for Android
For completeness, doing the same operation for the Android world is as easy as installing the correct version of Android Studio and the two necessary plugins: one to be able to directly write Dart code and compile it, the other to perform compile compiled products from Flutter. No Homebrew and no strange configurations.
They have thought of everything
For those who, like me, use a lot of Visual Studio Code, there is the plugin for Dart and Flutter: in this way we can write and debug our code in the lightweight Microsoft home editor.
A long but not complex procedure
Installing all the dependencies we need to use Flutter with iOS is not complicated, but it is definitely long. In general we should worry about:
- Install Homebrew
- Install a version of cocoapods equal to or greater than 1.5.3
- Install the Homebrew packages needed to connect Flutter to our device or iOS simulator (usbmuxd, libimobiledevice, ideviceinstaller, ios-deploy)
Everything is ready
Once flutter doctor stops telling you that there are no dependencies or plugins for the environment you are interested in, you will be ready to write your UI.
I personally configured both the iOS and Android environment in a couple of hours.
In the next chapter we will see instead of taking the first steps in the code.
Stay tuned!
Diego