Trying Flutter
Tags: flutter, android, ios, dart
Published: 2020-04-02 05:02:14

I have been seeing more news about Flutter lately mostly through recommendations from YouTube and from my social feed, which is mostly about technology developments. Having seen some of the examples that were highlighted in Google I/O and the vision for future, I must say I am quite impressed so far. Having tried multiple mobile frameworks/libraries in the past like phonegap, jquery mobile, android, Ionic and react native, I was a bit skeptical as to how things would pan out. 

To have something to measure against, I thought of creating a simple mobile project that required some UI and some backend which is usually the norm across most applications. The source code is available [here](https://github.com/allentv/calculator-app) for reference. This took me a week to develop in my spare time along side a full time job and raising a toddler. With this project, I was trying to understand how hard it would be to translate ideas that I had into an actual working product and would there be any show stoppers. Here are my findings.

The development environment was easy to setup. VSCode has good extensions for Flutter and the SDK was a breeze to setup. Having integration built into the IDE especially around debugging and UI updates felt amazing. I had both iOS and Android simulators running on my mac along with VSCode and did not see a drop in performance at all which speaks volumes about how well the tooling is done. Upgrades are fairly easy to do through the CLI and it also has commands to check the status of SDKs and devices whic I find quite useful.

You have to learn a new language that you would probably would not have heard about, called Dart. Apparently it is used quite a bit within Google and touted to be easy to learn for those with some OOP experience. The last time I read about Dart was in the SASS blog where they talked about rewriting the compiler in Dart for performance reasons and also for the ability to generate Javascript code automatically. So naturally I was quite curious on how the language is structured. Having used multiple programming languages in the past, learning Dart was quite straightforward and was easy to get productive. Finding help was not too hard especially with good examples on dart.dev website.

UI Layout was something to get used to. I had expected this part to be hard to grasp having dealt with XML based declarative layouts and code based layout creation in the past. I was skeptical as to how complicated things would be. The nesting of widgets did turn out to be quite a monstrosity to handle since widgets deal with one thing at a time. The focus is good for understanding what can be achieved easily but then you are faced with a large nesting tree that is not easy to read and understand easily. The way to reduce cognitive load is to create your own reusable widgets especially for those that have similar structure and then reuse them. This approach made my layout code more readable especially for the buttons. The upside is, you can subclass the standard widgets and expect things to work correctly out of the box. I like the approach of having specialised component set for both Android and iOS platforms that try to keep the behaviours as close as possible to the native feature set.

Expressivity is touted as one of the best things about Flutter where the community tries to prove that having design parity is not impossible. Customization is lauded and trying to get unique user experiences into the hands of the user is key. I haven't had much time to explore customization in detail though I would definitely like to try out some of the design concepts from Pintrest or Dribble in future.

The mobile app responsiveness was quite impressive. Haven't noticed any lag at all, in rendering or interaction and felt like a native app even though the whole framework does a lot of custom stuff under the hood. The Flutter team has given talks about how they built the framework and what goes on under the hood which are available on [YouTube](https://www.youtube.com/channel/UCwXdFgeE9KYzlDdR7TG9cMw/). Considering that everything you see on the screen is painted in real-time at 60fps, it is quite a feat!

The community around Flutter is growing everyday which for me is a sign of increasing adoption. The website pub.dev is a good place to find packages that are contributed by both the Flutter team and the community. The variety and availability of packages reassures me that my productivity won't be affected much when I want to build my next mobile app as I expect to find a package that would match my needs. I learnt a good deal of Flutter by just watching YouTube tutorials and trying to understand the process by which folks built apps. It was nice to see how designs are coded to life with a fairly good throughput and motivated me to try things out. The number of Google Developer Experts (GDEs) in Flutter are also increasing.

Overall, I would definitely recommend looking into Flutter if you would like to try out mobile development without much hassle. If you are looking for something with strong native (hardware) integration, then this might not be the solution at this time. Happy Hacking!