Developing mobile apps in Flutter
Why Flutter?
For some time, iOS apps are written in Swift and Android apps are written in Java. There are exceptions, but that’s how it normally goes for native code. People normally refer to Swift and Java as the benchmarks for “native performance.” If you want a cross platform native performance (ie fast), you had to learn two languages. Two languages that don’t necessarily work the same way, support the same frameworks/libraries and will have independent codebases.
Double the workload, double the bugs, double the work of keeping fresh on both languages.
Flutter is Google’s answer to this problem. Flutter is built on Dart. It’s basically a UI and mobile package on top of Dart. Dart is pretty simple, easy to learn and designed to be fast. It can be used to write apps for iOS, Android, web sites, backend (server side) and soon desktop. The desktop functionality is still in alpha state. The language did start a bit rocky, but a lot of the issues were resolved with version 2. They’re now up to 2.7.
Google wrote Dartpad to make a fully functional web IDE for Dart and Flutter. It’s great for quick code checks. Theoretically you could develop the code for an entire Flutter app in Dartpad.
Flutter Alternatives
There are some platforms that work cross-platform, but either have performance penalties or limitations.
Cordova is an interesting one, that I’ve used a bit. It strictly works with HTML, CSS and Javascript for both iOS and Android. If you’re writing an app that doesn’t need any local phone resources, it’s probably the fastest way to develop mobile apps. You can just write a web site, and use APIs or Javascript for complex functions. It can make for beautiful fast apps. Where it falls down is using local phone resources. Cordova uses the built-in system web browser in iOS and Android, so things can get a bit hack-y. You have to use JavaScript packages to use the web browser backend for storing data, or accessing GPS, or taking pictures. It’s definitely do-able, just a bit hack-y.
How do you develop Android apps in Flutter?
Download the following:
- Android Studio
- Flutter Installer
- Optional - Visual Studio Code
You may need the latest version of .Net framework, Java and Powershell. The installers will let you know. Once you run all the installers, go to the command line and run flutter doctor
You’ll get a report of how well the flutter install is working. If you are using a phone for your mobile testing, make sure you have a good USB cable. A very large number of cables fail USB specifications. For Android phones, hunt down the ADB drivers for your phone and google how to enable developer options on your specific model.
After you run the installers, update everything. Fire up the Android Studio, launch the Android SDK and download the last couple versions of Android.
How do you LEARN how to develop in Flutter?
I lucked into Udemy’s course on Flutter, Complete 2020 Flutter Development Bootcamp with Dart which was created in collaboration with Google’s Flutter team. At the time, it was $10 for Christmas 2019 and $20 currently. The Course Resources are available on Github.
Awesome Flutter is a curated list of Flutter resources.
Official Flutter Examples is a list of example Flutter apps.
Pawan Kumar’s Flutter Examples is an even better list of example Flutter apps.