Flutter is a fresh framework from Google for application development for Android and iOS. The programming language used is Dart (also developed by Google).
Let's understand the launch of our first application on Flutter.
To create our first application that will run under Android, you need to install all the necessary components. The installation of these components will be done in the Ubuntu Linux OS.
In the official documentation, it is first proposed to download Flutter itself, and then unpack it.
cd ~/development tar xf ~/Downloads/flutter_linux_v1.0.0-stable.tar.xz
Further they propose to add the flutter utility on the way so that you can run a diagnostics of the presence of all necessary components in the system.
Then the utility flutter doctor is launched, which will show whether all the components are in the system
[-] Android toolchain - develop for Android devices • Android SDK at /Users/obiwan/Library/Android/sdk ✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ • Try re-installing or updating your Android SDK, visit https://flutter.io/setup/#android-setup for detailed instructions.
First of all, they suggest indicating the paths to the Flutter SDK. For this you need:
Find the directory where flutter was placed. If you followed the instructions, the path should look like this.
Open or create file
Add the path to the flutter sdk to this file
Update bash environment
You can check that the path is added.
Since this is a configuration guide for Linux, you can use the installation of Android Studio through the snap system packages. It really is easier.
sudo snap install android-studio --classic
I’ll skip the default Android Studio setting, for example, setting a color scheme. Since the most important point is to install plugins for working with Dart and Flutter.
Find these parameters in the settings File -> Settings
You will need to run flutter foctor --android-licenses again to comply with all licenses.
After that you will be able to create Flutter project Start a new Flutter project
Pay attention to the project structure. External Libraries must have all the necessary components:
- Dart Packages
- Dart SDK
- Flutter for Android
If some of the items are not available, then you may need to either reinstall Flutter or correctly configure the paths in the IDE settings.
Next, connect a smartphone to your Android computer to perform the last item on the required components. You can certainly use an emulator, but personally I prefer a live device. In the end, Android smartphone in this case should be at hand.
And check that everything is in order through the flutter doctor.
Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, v1.0.0, on Linux, locale C.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK 28.0.3) [✓] Android Studio (version 3.2) [✓] Connected device (1 available) • No issues found!
After assembling and installing apk on a smartphone, you will see such an application.