Experience With Flutter
In one of my previous posts I mentioned about a project that I wrote entirely using Flutter. This is the continuation of that post. I will go into the details of how Flutter became the platform of choice and my experience with it. Let me preface by saying that this may be interesting only to a limited set of software engineers. So if you are not one of them, it'll serve you best to skip this post.
What is the project?
If you haven't read my previous post explaining the project, here is a brief recap. I have a bunch of friends who I want to keep in touch over the phone. So I wanted an app that will load all my contacts and make a friends list. Then it should recommend a friend to call next based on the call history. The top recommended friend should be the one that I called the longest time ago. There are a few more nuances but we will get to that later. This was my simple idea when I started the project. I named it Friend Roster.
Just a web app
Initially I just wanted to build a web app. A responsive web app that works well on a desktop browser as well as on a mobile device. Going by the PWA principles, it should also be an installable app. I have written several PWA apps in the past like this, this and this. So I am well versed with the platform and tools that I use to build such apps. However, I wanted to do something different this time, otherwise it gets boring now doesn't it? I have been hearing a lot about Fuchsia and Flutter and have been itching to try them out. After learning that web support in Flutter graduated to beta, I decided to take the risk and build a small app. And Friend Roster project will be the first one to use it.
As usual there is always some effort required to setup any new platform. Flutter was no different. The development machine I use runs Manjaro Linux and thankfully all the tools are available as installable packages. I did not have to download and install anything in my local workspace. I installed flutter beta (SDK), android studio (IDE) and chromedriver (integration testing).
Next I created a new project using the IDE. Soon I was up and running with a hello world app running on my chrome browser! While Flutter web does not support hot reload yet, the hot restart is plenty fast for my use case. I did not have to run a web server, or a file watcher or don't even need to refresh the web page. I just make code changes and as soon as I save, the page is reloaded in under a second. The build, run cycle is super fast. Love that!
It does not end there. I enjoyed the coding experience as much. Flutter makes development fun again. I was able to add a lot of functionality with very little code. Can you believe that my whole app was just under 1000 lines of code? I used to enjoy coding in python for similar reasons. The language is so flexible that you can do a lot in just one afternoon.
Android used to be as simple back in the day. But now with all the new requirements (run time permissions anyone?) and 10 ways to do one thing (AsyncTask, AlarmManager, Runnable, TimerTask, Service, BroadcastService, Thread etc) you get lost. Anyway I digress. I am comparing with android because that is where I've spend most of my coding life.
Not just development, but writing tests are fun too. As usual there is some initial learning curve but it is not as steep. No wonder I have great test coverage at 99.6%. Not just unit tests, but component tests and golden tests were all easy to write. I did not write integration tests, but I would like to add them one of these days.
That is the story of my Flutter experience. Still more to come in future posts. All I can say is that I loved Flutter so much that I decided to use it for my next two projects too. Yeah I have a long list of projects that I want to work on.