Flutter – the future of cross-platform or yet another “Google Glass”?
When talking about cross-platform, we’re still on the React native wagon. While there are quite a handful of choices, other cross-platform frameworks lack the flexibility we need, are proprietary or simply cannot suffice when achieving various business scopes. It is to mention that one framework caught our attention more than any other would have, maybe because of all of the fuss it caused during Google’s Developer days in Shanghai last year. You’ve got it right: we’re going to write about what is Flutter and see if this one is yet another “Google Glass” service or if it worths your attention.
A SHORT DEFINITION AND SOME BACKGROUND
Flutter is a cross-platform framework that comes to replace native development. Created by Google as an Alpha in May 2017, the platform seems to have passed the public’s eye up till last year, when their beta got more traction than expected after Google’s Developer Days in Shanghai, back in September 2018.
De facto, Flutter’s story began as “Sky”. Unveiled back in 2015 at Dart developer summit, the prototype was presented as a solution intended to enable rendering consistency at 120 fps within mobile applications. In two years, Google’s team decided to develop Sky as a multi-purpose solution that would also aid application development for their mysterious Fuchsia OS, that is still in development to date. The framework got yet another popularity bump back in November 2017, when Google announced that Fuchsia OS supports the Swift programming language. That meant the new framework would also be able to produce applications for Apple’s iOS.
As a result, Flutter Alpha and Beta caught even more traction within the Open Source community, as a framework with increased chances to leap ahead a truly cross-platform paradigm, that delivers genuine mobile experiences, regardless of the user’s platform.
Flutter got even more buzz back in January 2019, when native Android App support has been confirmed as part of its codebase. Only a month later, Flutter 1.0 has been released as a stable open-source framework everyone could use, and that’s when we started “flirting” with it.
FLUTTER’S INNER WORKINGS
As a framework, Flutter is based on Google’s Dart platform, an object-oriented, general-purpose programming language that is used to compile desktop, mobile, server and web applications. On top of Dart, lies the Flutter engine.
Written primarily in C++, this structure combines the benefit of low-level rendering via Google’s Skia graphics library, with platform-specific SDKs released by both: Android and iOS.
This way, the Flutter engine acts as a portable runtime environment, that implements core platform-specific libraries, animation/graphics methods, Input/Output network methods, file management as well as accessibility support methods. Also, the engine is built as a plug-in architecture based on Dart’s runtime that gives access to an advanced compiler toolchain.
The toolchain allows Flutter to compile Dart code to C/C++ ARM machine code, hence, the resulted build can act like a native app, eliminating the performance-related drawbacks, as well as compromises related to hardware access or specific platform OS features.
Besides its primary engine, Flutter makes use of a Foundation library, enriched with basic functions and classes, designed to deliver the possibility of building a native app by making use of both: various ready-to-use UI widgets and direct access to the application’s “canvas” commands. This flexibility made Flutter a base for other open-source frameworks, like Flame (a library used as a game engine).
WHAT MAKES FLUTTER APPEALING TO DEVS?
There are uncountable reasons Flutter is popular amongst early adopters, and here, we’ll refer to a shortlist a native developer would consider switching to this framework.
1. The community
Despite its relatively young age, Flutter managed to gather over 25,000 GitHub stars. It might be because it’s a Google framework or simply because it follows on GoLang’s steps.
5 years ago people were quite sceptical about that particular programming model and were quite frankly afraid of implementing micro-service based solutions. Now, with IBM Bluemix, Lambda and AWS on the rise, it turns out that Google knew one or two things about heading to the future and their software initiatives aren’t quite frankly the same as their hardware ones.
2. Simplicity as a rule
From installation to the compilation, things are quite simple. Compared to other cross-platform solutions, Flutter’s runtime environment is neat. You could actually dare to weight Flutter’s development processes against a native build. No other cross-platform can deliver a friendlier environment as this one does. On top of that, Flutter supports major IDE’s such as Android Studio, IntelliJ, or VSCode.
3. Rich documentation and feature set
4. Fewer dependencies on project setup
As compared to most performing cross-platform solutions on the market, Flutter is really good at managing dependencies. In addition, there is way less boilerplate code to write since you have almost anything needed to get you started from the framework’s foundation library. Again, since Flutter uses “simplicity as a rule”, setting-up a cross-platform project has never been easier.
5. Routing out-of-the-the-box
Building multiple pages or screens for a mobile app has never been a bed of roses. However, Flutter manages to make a pretty nice impression here too. Unlike other cross-platform solutions, Flutter comes with yet another trick out of the box. All the full-screen views (or screens) are called routes and these are managed by a quite useful tool called the “Navigator widget”. This widget manages a queue of Route objects and provides various solutions to manage them, giving developers any tool there is to generate a native user experience. Heck, this puppy can even generate platform-adaptive transitions, without any additional code.
5. Hot Reload
There’s a mention about it somewhere above, but this one deserves its paragraph. Flutter comes with a “Hot Reload” feature that makes a developer’s day. Simply put, this goodie allows a developer to see changes instantly as compared to waiting for Gradle or XCode to build upon or reflect them. For those that have to spend hours on UI – this is simply “a diamond in the sky”.
6. Less code to worry about
First, one of the most important gems here: if you managed to carry on your business scope in a flutter-based Android app, the code you wrote is 100% re-usable for iOS. Yes, there are some limitations for devices that carry an Apple bite, but if you made your way around them – that is it. You don’t have to write any additional code for the iOS twin.
Second, even when building native apps, you must maintain two separate layers: the actual code and the UI layout. Usually, your layout is described in XML or Storyboards, and it is referenced into your code layer later on. Now hold your chairs. Flutter treats the layout and the code as a whole. Essentially, since everything is a widget, the layout is generated by Dart.
Both of these benefits result in less code, which in turn means fewer bugs.
7. Smoother animations by default
If you need a quick-fix MVP, Flutter is the way to go. You won’t even have to compromise on UI limits since most of the animations (like UI interaction feedback or button taps) are integrated by default and, in some instances, available as a drag and drop. In addition, since Flutter uses Material Design and Cupertino out of the box, you can build attractive UIs for your Android or iOS MVP at a glance.
8. “Shazam”-like performance
Anything you build on Flutter will compile to ARM code, which places this cross-platform closer to bypassing bottlenecks, the latter currently being possible only in the case of a native build. Sure, this framework is still in its early days but given to what it can do now, you can only imagine what it would be able to solve in a few years or so. Like a fresh super-hero around the block, Flutter just got it’s “powers” and I bet we’ll see more coming.
To conclude, in matters of future developments, Flutter does not have the potential of becoming the next “Google Glass”. With its promising roadmap, this framework has a lot to bring on to our digital tables (like true cross-platform apps that can run on Windows, Mac and Linux). However, it still has to pass the HighLoad and long-term production tests before it will settle in as a standard within professional software houses stacks.
Flutter is an amazing tool and it definitely deserves some space in the toolbox of any mobile-oriented agency, but before that happens on our end, we still need to put it to a race against our current top-choice among cross-platform builds.
Otherwise, if you’ve also had the chance to flirt with Flutter, please share your experience. Maybe we’re too excited about it, maybe there are other things to consider or maybe we missed some of your favourite things about this newborn. For all of that, there’s a comment section.