“We are like butterflies who flutter for a day and think it's forever.” Carl Sagan
Flutter is Google’s cross platform open source tool launched in 2017 and officially out of preview in 2018. Recently, several companies, including Airbnb and Udacity, have announced that they have abandoned cross platform mobile development in React Native, and returned to native iOS (Swift) and Android (Java/Kotlin) languages.
Is Flutter an improvement in the cross platform arena? Is it suitable for production? Should your team adopt Flutter for mobile app development?
What is Flutter?
Flutter is an SDK for building mobile apps on the iOS and Android platforms. The key features of Flutter, in common with several other cross platform mobile SDKs such as React Native and Xamarin, include:
- The ability to develop for both platforms using a single code base
- Rapidly prototyping your running app using hot reload
- A library of platform-like widgets or build your own design without the constraint of platform-like widgets
However, Flutter is unique when compared to other cross platform tools in that it makes no attempt to mimic the underlying native SDKs. Instead, Flutter uses its own high-performance rendering engine, Skia, to draw widgets. Skia is a 2D rendering engine written in C++ used in Google Chrome and Mozilla Firefox.
Flutter requests a window from the underlying OS and entirely manages its own content in Skia using Dart. This means that all UI logic such as scrolling, touch events and animations have to be re-implemented in Flutter. This is very similar to the approach taken by game engines.
A Comparison of Cross Platform Tools
|Developer||Initial release||Primary language||SDK support||Compilation|
No access to native UI elements and logic.
Some out of the box access to APIs, majority of native SDK accessed via asynchronous message passing.
|Compiled AOT into a native ARM library.|
|Xamarin||Microsoft||2011 (Forms 2014)||C#||
Access to all UI elements and logic.
Strongly typed bindings to all native SDKs.
iOS is compiled AOT into native ARM code.
Android is compiled into IL, then JIT compiled to native on launch.
"Hello world" comparison
Flutter “hello world”
React Native “hello world”
Xamarin Forms “hello world”
Benefits of Flutter
Flutter is fully compiled ahead of time (AOT) and uses the fast Skia rendering engine, which leads to very fast mobile apps. Flutter uses a reactive style of programming where UI elements aren’t altered directly, instead they automatically update in reaction to changes in state. During development, Flutter supports hot reloading to automatically update the app once changes are saved in the code editor.
From a design perspective, you aren’t constrained to using iOS and Android specific UI elements, you can create something fresh according to your needs. Because you won’t be using native elements, you don’t have to handle different capabilities or attributes specific to one platform but not the other. Flutter has built-in support for unit testing of code and UI widgets, and also theming for every aspect of an app’s UI.
Because of the platform-independent way of rendering the UI using Skia, Flutter opens up other platforms as possibilities for example web, desktop and smart TVs.
The Downsides of Flutter
One of Flutter’s strengths is also its biggest weakness - if you want an app that looks like a conventional iOS or Android native mobile app that is. The lack of support for standard platform UI elements means that your app must use a library, Cupertino for iOS and Material Components for Android, to mimic their look and feel.
If Apple, for example, were to introduce new or modified UI elements in a future version of iOS then your app would not reflect the new look until the Flutter Cupertino library was updated and a new version of your app released.
The Flutter community is newer and therefore not as large as those who champion React Native and Xamarin, meaning there are less libraries and 3rd party tools. There is no dedicated IDE such as XCode and Android Studio, but Flutter development / debugging support in Visual Studio Code is getting better with each new release.
Another significant disadvantage occurs should you wish to use native iOS or Android features in your Flutter app. Not only do you have to use the asynchronous messaging passing bridge, but the code for the iOS-specific parts needs to be written in Swift and the code for the Android-specific parts needs to be written in Kotlin. This is quite clumsy compared to Xamarin which supports all native SDK features and which can all be accessed using C#.
There are many other minor issues that no doubt will be addressed by Google or the community over time, such as support for bitcode which is required by Apple for watchOS and tvOS apps, password autofill from the built-in native password managers, payment gateway integrations, overall size of .ipa and .apk files.
In the area of security, again, Flutter is dependent on what limited built-in native SDK features are supported and the capabilities of Dart. Both https and TLS are fully supported, secure storage is via iOS Keychain and Android KeyStore, Dart’s encryption libraries are not as good as iOS and Android, but solid enough, basic biometric authentication is available but, again, not as rich as the natively provided capabilities. Flutter also requires you to incorporate a license page which shows licenses for software used by the application.
So, what IS all the fuss about Flutter?
Flutter is a very exciting development in the mobile app space, partly because of Google’s backing, but mainly because of the fresh approach it takes to app development. If you are looking for your app to be free of the shackles of the standard iOS and Android UI elements and you don’t need too many native SDK features, then you are in for a treat as Flutter will give you a great platform for developing fast, great-looking mobile apps.
However, if you are looking for a more conventional-looking mobile app or something that uses more native features, or requires significant 3rd party integrations, then it may be worth waiting a little longer before releasing your company’s first Flutter app.
With new features and support provided by Google and the community, it will no doubt get to a production-ready state, but for now it’s a risky step to rely on as your main route to mobile.