FLUTTER: cross-platform apps by Google

18.04.2018

Dariusz Sęk
Software Developer
Dariusz Sęk
Dariusz is a mobile software developer who has professional experience in both Android and iOS platform. He is interested in technological novelties like new Fuchsia OS and Flutter framework. Privately fluffy dogs lover.
 

When Google provided the initial release of their new mobile development SDK (May 2017) we strongly believed that it would be the next cross-platform solution which wouldn’t change anything. There are many frameworks on the market like Xamarin or PhoneGap, but due to the numerous disadvantages of these platforms, they are not our leading technology for developing mobile applications. Cost optimization isn’t worth sacrificing performance or user experience. Our applications must be highly responsive and user-friendly in terms of appearance and usability. Will Flutter let us achieve this?

A fast app is great, but a smooth app is even better

Flutter aims to provide 60 fps performance, or 120 fps performance on devices capable of 120Hz updates. This is important, because it shows the approach to creating applications that not only WORK, but are also smooth. The emphasis is not only on compatibility between systems, but also on many other factors. This is a big step forward because many cross-platform frameworks have significant performance problems. Even the newest devices from technological giants don’t ensure the smooth operation of such applications. So what can we expect when it comes to UI/UX? Do smooth applications for the cross-platform framework mean poor design and small possibilities of interfering with the appearance of the app?

The kingdom of widgets

In Flutter everything is a widget. The whole app is a set of nested widgets. There is a possibility to create stateless or stateful ones. When you want to update the UI, you just need to change the state of the widget and call the setState() method. It sounds like laying LEGO  blocks and it’s a bit like that! You need only about 400 lines of code to build a simple chat app based on Firebase. The widget concept invented by Google is quite clever and ensures good performance, smooth animations, and very big possibilities when it comes to UI. What’s more, Flutter packages provide a lot of standard Android and iOS components. Even the default behavior of these components is taken from a given platform!

Let’s play darts

To play with Flutter you have to use DART language. Semantic looks like a mix of Java and Javascript, there’s nothing weird or surprising inside. You won’t be scared looking at the code, as in the case of Objective-C :) If you are familiar with the aforementioned languages, you don’t even need to follow any tutorials. You learn everything by creating your first app. Currently, version 2 of DART is being prepared and we are waiting impatiently for its release!

Take care of the environment

Currently, Flutter supports both Android Studio (you can also have IntelliJ) and Visual Studio.

In case of Android Studio (IntelliJ) you need to install two plugins:

* the Flutter plugin powers Flutter developer workflows (running, debugging, hot reload, etc.)

* the Dart plugin offers code analysis (code validation as you type, code completions, etc.)

To use Visual Studio you just have to install the “Dart Code” extension. Yeah, that’s it!

Launch the rocket

Google prepared two codelabs for developers to get familiar with Flutter. The first of them will teach you how to build beautiful UI  and the other shows how to use Firebase and build a  simple chat app similar to Whatsapp. We are amazed by how quickly you can build an app that combines signing in, sending messages or photos and has a very nice UI. What’s more: it works on three platforms! Sounds great, doesn’t  it?

Three platforms?

Android, iOS, and of course not Windows ;) Google is working on a new OS called Fuchsia. This will probably be the successor to Android. Through Flutter, Google wants to saturate the market with apps compatible with their new system to provide users with a fully-finished system. However, the change between Android and Fuchsia will take a few years. Even so,  it is worth being interested in Flutter due to the possibility of developing applications on both iOS and Android.

Production ready?

On the official Flutter website you can read that Flutter is now in Beta. Therefore, one would think that it is not yet time to use it for  production. We were very surprised when on medium.com we read that there is already an app with 200k downloads! In the article it is mentioned that the developers of this app also reviewed Xamarin and React Native before making the final decision. It appeared that Flutter was a good choice. They don’t complain about the performance and are happy with the very rich widgets provided by Flutter and had no problem with any implementation of UI. When they started to create the app, support from the Flutter community was very poor, there weren’t too many libraries either. But it was in the summer of 2017! Now, the community is getting bigger and bigger, there are a lot of libraries and helpful websites about Flutter. What if you need platform specific functions? In Flutter it needs to be called from the platform side and implemented by platform native languages (Java or Kotlin for Android, Obj-C or Swift for iOS). It is the same as developing on the platform standard, so any available library can be used! Looks brilliant, but is it really so rosy?

 … or not really?

There are more than 3,000 issues registered in GitHub. Therefore, it is very likely that you will experience several errors while creating your app and they will increase as your app grows. On the other hand, new versions of Flutter are released every few days, bugs are actively eliminated. It can be expected that the final version of Flutter will be a complete app development framework and a very serious competitor of the native creation of mobile applications. One thing is for sure – you should be prepared for the arrival of Flutter’s era!