9 months of Flutter development later, feedback.

Alban Lorillard
6 min readDec 29, 2021

--

“Build apps for any screen” from Flutter.dev website

2011, Google launched the first alpha version of Flutter and for many years, Flutter stayed in the dark. Flutter is a solution to build hybrid mobile app with native code for Android, iOS and web. Since 2018, the stable version 1.0 is launched. Firstly, without null-safety. Then, since 2021, the version 2.0 includes null-safety that involved many refactoring, including updates for all dependencies. A big refactoring between the 2 first versions, it’s not without reminding the story of Angular JS / Angular 2+.

Flutter is an open-source framework based on the Dart language, a Google language launched in the same time, very similar to Java or other object-oriented programming. For the moment, we can easily affirm that Dart mainly lives thanks to Flutter.

Flutter is a solution that competes with React Native, Ionic … and is now a serious choice for hybrid app since big business like SNCF announce for example that his future app, Sncf Connect, is developed with Flutter. Google Pay, Ebay, BMW, Toyota are also other examples of business that have chosen Flutter for his app.

Let me introduce you

  1. A quick overview of the dart language
  2. A quick overview of the flutter framework
  3. Some interesting packages to work with
  4. My personal opinion

A Dart overview

We could be afraid to learn a new language, then, a Framework. In fact, it’s not really painful. Dart is really similar to Java. We retrieve most concepts from Java including OOP characteristics, but also, some similarities like streams and features from other languages (null-safety, promises or the dynamic type).

Dart has also his own features like named constructor :

Dart with named constructor

In my own experience, with skills from Java and Typescript, it was natural to understand and start developing in Dart. However, there is some shortcoming in the language. The greater are Enums : there are not as elaborate as Java and are frequently replaced in String type while we deal with data or want to use it as UI label for example.

Enums in Dart.

Dart is use mainly for Flutter, but could be a serious competitor to other back-end language. It is similar to Java that make the learning easy and embed null-safety to prevent NPE. The Dynamic type allows to use flexible and imprecise type in order to facilitate data integration from external source. We also retrieve the cascade operator (..) to quickly call many methods from an instance.

Feel free to take some minutes to check samples from the Dart website :

A Flutter overview

Flutter is nothing else than a Framework based on Dart in a same way that Angular is a Framework based on Javascript. It embeds Material Design components as a Dart library, a lot of tools to build and test app on Android, IOS or Web quickly. In flutter “All are widgets”. A Widget is similar to the component notion in React or Angular for instance. The DOM could be comparable to the tree of widgets in Flutter.

Flutter has two types of widget : stateful or stateless. Statefuls are comparable to React components with states defined while stateless are fixed component (for example, a React component where you only use Props)

Example of Stateless Widget
  • Container could be similar to a simple <div> in HTML, you can add attribute like Padding for instance and can have only one child.
  • Column (or Row) are widget that could be similar to a flex <div> in HTML/Css, with the correct flex-direction. You can also use similar properties like the space-between rule in CSS.

If you have also deal with Angular or React, Flutter as a similar logic and, in my opinion, it’s really less painful than the Android XML Layout to draw UI.

Many components are displayed in this gallery.

My firsts steps with Flutter was really easy to understand and fast to deploy. On the contrary of native development, Flutter embedded hot reload and hot restart so that you can see your modifications in real-time. The similarities with web development help you design and understand the flutter structure and quickly get started with the framework.

Around Flutter

Dart and Flutter started to have a large community gathered in the Pub Dev ( https://pub.dev/ ). It is the official repository for packages. Many connections with natives devices functions are also develop and available in libs that you can find on pub dev. I present you some major of them you should know for your firsts developments :

1. Geolocator

Getting access to the GPS is a common usage in mobile. Geolocator help you ask permission to access and request the device location for iOS or Android.

2. Flutter local notification

Send or schedule notifications is the promise of flutter local notification.

3. Get It

For large app, you will probably want to have only one instance of your services. Thanks Get It, you will be able to introduce dependency injections (like in Java Spring) and load your service when necessary.

4. Autoroute

In your app, you will probably want a well-organized routes system. Thanks autoroute, deeplinking, or accessing to a screen from an other screen will be more simple.

5. BloC and Cubit

BloC and Cubit are also structured libs that architecture your app and handle states. Thanks them, states could be shared between widgets and screens in a smooth way. This responsibility is externalized from widget and the dependence of a feature is not linked to a UI.

There is an extra gap to understand and learn Bloc and Cubit and determine in which case you will need to use Bloc or Cubit. But once you jump the gap, you could not do without it !

6. Firebase

We no longer present Firebase, a large cloud-based environment for mobile app including notification sending, databases and authentication products. Firebase and Flutter are two Google products that implied that Firebase is fully supported on Flutter with a specific documentation for it.

To discover widgets and libs, the flutter youtube channel do a focus in each videos. An easy way to quickly learn the framework : https://www.youtube.com/channel/UCwXdFgeE9KYzlDdR7TG9cMw

Personal opinion about Flutter development

Because of an hybrid framework, Flutter inherits of the sames disadvantages of others hybrid frameworks like a same UI between OS, a slowness, not-native UI effects and some specifics code for an OS due to specifications. Flutter do not prevents some development inside native code (swift or kotlin).

However, I’m pleasantly surprised with Flutter. It’s fast to develop, fast to deploy, the code not come from a web language, so that, the build in the native OS language is most realist and without web-view for UI rendering. The Dart language contains a lot of specifications of common languages and it is easy to learn. After developing within a very large team, I’m pretty convinced about his flexibility.

Finally, it stayed an economic and smart choice : just one project, no code duplication between OS (shared code-base), java or web developers can easily up skills in flutter and you can retrieved better performance than web-based hybrid languages.

--

--

Alban Lorillard

Software Engineer, I‘m full-stack developper @ Sncf Connect & Tech and web developer mentor for Openclassrooms's student. My articles refers only to my opinion.