Here at DuckMa, mobile apps are developed natively. By utilizing the Android and iOS SDKs we can tap into the maximum potential of each platform which enables us to satisfy any of our customers' requirements. While offering a lot of benefits, native development has one major downside: everything needs to be developed twice, once for each platform. Therefore, during the last decade, a lot of companies developed different technologies to provide their unified SDK for easy multi-platform development. Some examples include PhoneGap by Adobe, Xamarin by Microsoft, React Native by Facebook and the latest of the group: Flutter by Google.
Disclaimer: when we first used Flutter, the SDK was still in beta stage. It has been moved to Release Preview 1 recently, so some of the downsides may be gone by now.
Originally presented under the name of Sky during the 2015 Dart Developer Summit, Flutter was released as an early Alpha in May 2017 during the Google I/O event. One year later it has entered Beta stage and it is proudly presented by Google as a mobile app SDK for crafting high-quality native interfaces on iOS and Android in record time.
Stateful and Stateless Widgets, written in the Dart programming language, are the building blocks used to create both the UI and the core logic of a Flutter app. In fact the whole app is one big widget that contains smaller widgets, each one performing it's specific task. By creating custom widgets and nesting them with the ones already available, a developer can build an app for both Android and iOS.
Creating a mobile app with Flutter has several benefits, one above all being its productivity value. Since the Android and iOS app share the same codebase, the time required for building an app is greatly reduced. In our case we experienced a reduction in development time of almost 40%.
We were able to cut the development time that much because Flutter doesn't have a templating language yet. Instead, each widget is responsible for both its inner logic and drawing its UI at the same time. This requires less context switch on behalf of the developer and allows faster changes while developing the app.
Because of the way it is built, Flutter encourages the use of good design patterns like Composition and Reactive Development. Composition is promoted by nesting different widgets, each one dedicated to complete a specific and self contained task. Reactive Development is promoted by the use of Stateful and Stateless widgets combined with an architecture that enforces a single point of truth which streams data from top to bottom.
Another useful feature of the Flutter SDK is its ability of Hot Reload. While developing a Flutter app it is possible to make changes to the code on the fly and sync those changes to the app running on the emulator or an actual device without the need for rebooting the app.
Finally, since Flutter is made by Google, it integrates very well with other Google's services. Firebase APIs in particular are easy to setup, integrate and use within a Flutter app. So, if your app's backend is something that can be implemented via Firebase' services, then Flutter provides an easy integration of several Firebase SDKs.
Although Flutter comes with several benefits that bring a breath of fresh air to app development, it does have have some limitations which do not make it ready for production yet.
The major issue we had with Flutter had to do with its early beta stage. We were able to build UI that looked and felt native faster than usual, but we got stuck when it came down to providing our app with some platform dependent functionality. The lack of native API integration out of the box required us to write the functionality in Java for Android, in Swift for iOS and then connect those part to Flutter through a platform bridge written in Dart.
Another issue is the general lack of Dart support available both on the official Flutter website, the official Dart website and on other more general websites online. Dart is a niche language that, despite Google efforts, has very low engagement across GitHub, StackOverflow, Freenode, Reddit etc. Because of this it is quite difficult to find the right resources when needed, or even a proper Flutter community.
One big area that could be greatly improved are the messages for build errors. Since Flutter hasn't reached a stable release stage yet, anything can change with each new version: including external libraries, native build tools and Flutter build tools. This can lead to builds failing for not apparent reason and the messages given by the Flutter builder do not help much in pinpointing the root cause of the error. We once got stuck for hours trying to make a Flutter project to build its iOS app only because the CocoaPods version we were using was not compatible. After a lot of research online we found a remote blogpost explaining the same issue and suggesting to downgrade CocoaPods. Once downgraded, the build completed successfully.
So, in the end, what is Flutter good for then? Flutter brings out its full potential in four cases:
- When used to develop small apps that are UI focused and, if needed, rely on Firebase for backend services (as an example check out our experiment Daily Quote).
- When used for new projects. It is definitely easier to start a new, whole Flutter app from scratch and build it from the ground up rather than include some Flutter elements in an already existing app.
- For one-man teams. If you are a solo developer who needs to create an app and have to target both Android and iOS then Flutter may be the right choice for you. Its cross platform capability can save you tons of hours of development time, avoiding you to build everything twice.
- Prototypes. Without a doubt Flutter is great for prototyping an app, it is quick and fun to use.
Flutter is a new cross-platform development SDK that is being improved by Google with each new version. Even if it is facing a slow adoption by developers and its current state is yet to be ready for competing at 100% with native SDKs, Flutter has proven itself as an interesting technology worth to keep an eye on. In the end, will Flutter replace standard iOS and Android development? Definitely not. But it is a welcome addition to the the family of SDKs focused on cross-platform development. Here at DuckMa, we will definitely give it another shot once it reaches its release stage.
- Quora | Is Flutter likely to replace Java for Android app development?
- Wikipedia | Flutter (software)
- Quora | What is the difference between PhoneGap and Cordova, and why would I select one over another? Cordova is the name of the open source version of PhoneGap, used by Adobe with Cordova as its engine.
- Google's Flutter
- Wikipedia | Reactive programming
- Announcing Flutter Release Preview 1
- Who Uses Dart
- Tech Republic | The 5 worst programming languages to learn in 2018
- Netguru | Introduction to Flutter: Part 1
- ProAndroidDev | Testing Flutter Applications
- Flutter Rocks | Putting build methods on a diet - tips and tricks for cleaner Flutter UI code