First touch to Flutter: native development within a cross-platform framework, is it real?
Before starting reading this article, I should warn you: I’m an Android Developer, and I’m against cross-platform frameworks due to their low-quality applications as a result. I just wanted to give Flutter a try, because it’s made by Android maintainer: Google.
You know that moment when you come up with idea that is extremely obvious, but you never paid much attention to it before? Well, I remember when I realized that everyone has a mobile phone in their pocket. Duh, right? But along with this thought, I decided that I want to collaborate with the worldwide community and help others supplement their toolbox with applications handy enough to use them every day. On that day I have started to learn Android application development.
Once I obtained the general tools and techniques of Android development, I tried a new powerful framework from Facebook: React Native. It was quite a nice experience: you have one code and two platforms supported. For small applications, like REST client, it might be very useful. But when an application gets more complicated, the quality gets lower and lower. State containers suck IMHO. They just can’t handle a lot of iterations in a small interval of time as fast as native platforms can.
But what about Flutter? Is there any chance that all native developers will switch to the cross-platform framework? Can developers produce higher quality applications with Flutter?
Products created with React Native, Cordova or other JS-based framework are hybrid applications. Actually, there’s nothing similar with native development, so, yes, Flutter can be better than React Native if we are talking about performance, because Flutter, as Xamarin, produces native applications without using any JS-bridge between your application and Android OS. What is under the hood of Flutter, then?
Flutter applications are better optimized regarding the Widgets — built-in UI components provided by the framework. Actually, my first experience was very good. With no documentation read, I’m still able to understand how to build an application interface in Flutter. Let’s take a look at the very first example presented by Flutter.
The framework allows building UI in a very intuitive way by providing Column, Center, and other container components. If you are new to Flutter, like me, without any pieces of knowledge on Dart, you are still able to imagine how your components will be positioned on the screen. But the problem is in the word “imagine.” Yeah, there’s no quick view on UI before running it on the device. Is it really problematic? I don’t think so since Flutter offers “hot reloading,” which allows you to quickly reload application after small changes. There’re some limitations, but it is so predictable that hot reloading won’t work on generics type changes.
Dart is a fruit salad of many other languages, IMPOV. There are expressions instead of a one-line function, underscore means private, asynchronous function invocation, and many more. Good job, sirs! At first, it looks quite ugly, but language offers a lot of features, so why not?
Furthermore, the Flutter framework forces developers to not break the main rules of UX application: you have only one Floating Action Button, only one body as a container, only one toolbar. That’s good limitations, because developers won’t be able to break main rules, as they can do in Android development.
Rich IDE support
For me, as Android Developer, there’s one more advantage: I can still work in my favorite IDE and develop Flutter apps. But for iOS Developers, there’s bad news: no integration with Xcode, is it too early or Apple didn’t like the idea? Thanks to the active community, I suppose, better than Xamarin’s, Flutter comes along with plugins to Android Studio, IntelliJ IDEA, and Visual Studio Code. Experienced IntelliJ IDEA users can understand how important it is. You have all those hotkeys, live templates, inspections and intention actions, which help you to write code in a very simple way.
Moreover, Flutter’s profiler is one of the most powerful tools I have ever seen (why they didn’t announce it loudly, IDK). Take a look at the screenshot of the profiler for Android.
Flutter toolkit contains many other instruments that will help you optimize the application, for example, a developer can switch to show all constraints of the interface, how it’s positioned on the screen and what paddings/margins it takes. Very useful things!
After a couple of evenings with Flutter, I would say: No, I don’t want to switch to this framework totally. It’s still very young. When I tried to run an example application, I didn’t have any problems with it, but when I’ve tried to open the existing project… Well, it was really problematic: the Android module hasn’t been recognized, so I can’t run existing examples easily. Why? I don’t know. Probably Android Studio hasn’t been fully supported. Yet.
Also, I found that my application works very slow. It was just a simple example of a navigation drawer with a few screens, but it doesn’t work as smoothly as it should. Then I opened Android Studio and launched the application in release profile. Okay, changes are much better, the application works very fast, as it should be.
And don’t forget, Flutter is open source with 56k of starred users, but with it comes almost 5k of opened issues.
Would I recommend to use Flutter for now? No. Would I recommend to use Flutter in one year? I predict, yes! I will definitely follow the evolvement of Flutter. I think that with enough time we may even use it to develop cross-platform high-quality applications!