Engineering

10 October, 2018

My experience with Flutter and Dart

Flutter development is different from other approaches to hybrid app development, and that’s mainly because it uses Dart.

António Valente

Software Engineer

My experience with Flutter development and Dart - Coletiv Blog

As an Android developer I have always been fascinated by the hybrid mobile app development world. Developing an app for both Android and iOS with one codebase is like a dream come true! You don’t have to deal with all the hassle of maintaining two different projects, and you don’t need to learn how to develop apps for Android and iOS which will take you quite some time.

That’s why I was always an early adopter of these kind of frameworks. I’ve already got my hands on Ionic, but since I’m coming from Android and had no real experience with web development, it was a bit difficult for me to learn and keep myself interested to actually invest time on it. That was a disappointing experience for me and since, almost all of these kind of solutions are web based, I lost my interest. At least until Google announced Flutter.

Flutter is different from other approaches to hybrid app development, and that’s mainly because it uses Dart.

  • Dart is really easy to learn. It feels very familiar and it’s syntax is clear and concise.

  • Dart is compiled “ahead of time” (AOT) into native code for multiple platforms, eliminating the need for a JavaScript bridge (like Ionic or React Native) and improving performance.

  • The Hot Reload feature lets you quickly and easily experiment your code and see the effects of your changes without waiting for the app to build, allowing you to be more productive.

  • Everything’s a widget, and each one of them is an immutable declaration of part of the UI. Unlike other frameworks that separate views, layouts and other properties.

  • It comes with a rich set of widgets for both Android and iOS to match the look and feel of native widgets, which can be easily tweaked and customized.

These are some of the reasons that made me interested on Flutter right away. And since, at Coletiv we are always encouraged to learn and try new things, I quickly did an experiment with Flutter.

#Flutter might be the solution we needed to develop proper apps with one codebase, and that’s mainly because it uses Dart.

The app idea

The idea was pretty simple. In Portugal there’s an app to pay for your parking sessions, but those sessions only last up to 2 hours. Which means that every time you need to leave your car parked for longer than 2 hours, you have to manually renew your parking sessions. That’s annoying!!! Besides, if you forget to do so you are greeted with a fine in your windshield.

Parking Ticket (Photo by Global imagens) Parking Ticket (Photo by Global imagens)

So we though: “Why not build an app that renews your parking session automatically until the time you specify it to do so?” and Flutter seemed the perfect solution for it, at least on paper.

We wanted the app to be available for both Android and iOS and we wanted to do it fast, since this was only an experiment.

In less than a week, we developed a functional app with the bare minimum necessary to allow users to setup parking sessions (check our Github). But once we tried to renew those sessions automatically on the background, Flutter started to reveal some lacking features and quickly reminded me that it’s only now getting ready for his first 1.0 release.

#In less than a week, we developed a functional app with the bare minimum necessary to allow users to setup parking sessions. That reveals how productive you can be with Flutter.

What went wrong

There is no easy way to execute Dart code on the background of your Flutter app (check this issue). It is possible to do so using platform channels, but that would require you to do platform specific code for Android an iOS and that kind of defeats the purpose of using Flutter in a project (if you want to know more about this I recommend you to read this article).

There is a plugin developed by the Flutter team available for Android, the Android Alarm Manager plugin. It allows to schedule and run background code on Android using the Alarm Manager but even that has problems like this one. On the iOS side there is not yet a solution to this issue, at least to my knowledge.

#We can’t expect the Flutter team to do in one year what took Android and iOS ten years.

Final thoughts

I think that a feature like running code in the background is really important and should be easily accessible to us developers on Flutter SDK. Instead, at least at this point, the Flutter team is kind of giving us the tools to do this on our own and hoping that the community contributes with plugins to enable the execution of background code.

And you know what? We can’t judge them for that! We might think that since Google is backing Flutter they are obliged to do better, but in reality the Flutter team is not that big and we can’t expect them to do in one year what took Android and iOS ten years. And since Flutter and Dart are completely open source, let’s just be glad for it and try to contribute whenever we can to make these awesome projects better.

Source code

The source code for this project can be found in here.

Flutter

Dart

Hybrid App Development

Experience

Mobile App Development

Join our newsletter

Be part of our community and stay up to date with the latest blog posts.

Subscribe

Join our newsletter

Be part of our community and stay up to date with the latest blog posts.

Subscribe

You might also like...

Go back to blogNext
How to support a list of uploads as input with Absinthe GraphQL

Engineering

26 July, 2022

How to support a list of uploads as input with Absinthe GraphQL

As you might guess, in our day-to-day, we write GraphQL queries and mutations for Phoenix applications using Absinthe to be able to create, read, update and delete records.

Nuno Marinho

Software Engineer

Flutter Navigator 2.0 Made Easy with Auto Router - Coletiv Blog

Engineering

04 January, 2022

Flutter Navigator 2.0 Made Easy with Auto Router

If you are a Flutter developer you might have heard about or even tried the “new” way of navigating with Navigator 2.0, which might be one of the most controversial APIs I have seen.

António Valente

Software Engineer

Enabling PostgreSQL cron jobs on AWS RDS - Coletiv Blog

Engineering

04 November, 2021

Enabling PostgreSQL cron jobs on AWS RDS

A database cron job is a process for scheduling a procedure or command on your database to automate repetitive tasks. By default, cron jobs are disabled on PostgreSQL instances. Here is how you can enable them on Amazon Web Services (AWS) RDS console.

Nuno Marinho

Software Engineer

Go back to blogNext