Over the past weekend I had some time to explore new tech. I found Flutter and watched couple of presentations and keynotes and it grabbed my attention right away.
In my current company I lead a mobile project using Xamarin Forms, targeting Android and iOS. I always think about how to boost productivity and performance of the application and at the same time maintain an acceptable level of standards and maintainability. Having that said, I’m not personally involved with the coding a lot and I mostly observe the development.
After years of being actively working with Xamarin I realized that if I want to depend only on the built in controls I cannot get very far from just a prototype. In order to have a production level polished app I need to spend lots of time developing custom controls. You are still sharing the same code base in terms of logic and the main flow of the app and it’s all great but it takes time and effort to make an app look great.
Flutter in the other hand is different. It’s based on Dart (which is new to me) and has a very expressive way of working with the UI. Soon after my second video I found my self typing flutter create hello-world. I followed couple of the online tutorials and managed to put a smooth working app together in a very short time. Then I couldn’t stop there and I created a new project to try out form fields and see if I can put a page together on my own. One hour later I had a login screen with icon-text-fields, validations, hints, moving labels, tap screen to dismiss keyboard and even a small little snack bar with cute notifications. It looked like a production ready screen to me comparing to what I could achieve with Xamarin in the same amount of time.
Here are a few bullet listed facts regarding my first experience with Flutter and Dart.
Let’s start with awesomeness:
- Hot reload is amazing. Once you use the hot reload feature it feels a bit stupid not to have that. You can literally save hours and hours of building your app while tweaking your UI. Change the code (even stateless logic) save it (and press r if used the command prompt) and it takes 700 ms for your changes to appear on the phone.
- Material widgets are awesome. Lots of small and important animations as well as very well designed default elements. This will give you the opportunity to deliver a prototype with close-to-production look.
- VS Code. Isn’t this amazing to be able to code for mobile in VS Code. Then hit F5 and debug your application. I think it is.
- Blazing fast. Yes, it’s much faster than Xamarin. The app runs on top of Skia. When you run the app it almost feels as if it’s a native app. So the overhead is very small.
- Identical look. Unlike Xamarin where the app looks very much like native on each platform, Flutter apps look identical on Android and iOS. This is good and bad depending on which approach you want to go. However in my experience today companies try to provide identical look on different platforms.
- Strong community. Well, if Google cannot build an active community around one of his product then who can. A well written documentation, active forums, lots of packages and many video tutorials.
Not so much awesome:
- The way nested UI is put together. Well widgets have child or children and then more children and more children. You changed your mind and you want to wrap the current UI in a Scaffold and commit the changes. The whole files is now changed and it’s almost impossible to spot the actual change in first look. I believe by creating widget files gradually this will be fixed to some degrees. However every now and then I found myself lost in jungle of nested curly braces and pretenses and had to spent significant time to figure out the missed or redundant one.
- Dart. It’s probably a silly wish but what if the language was C#. Still I think apart from the learning curve to master Dart it’s an interesting journey to learn a new language.
- No MVVM or MVC. Well some argue that this is the nature of Flutter not to have MVVM or MVC. Basically everything is one stream of logic with some nestings. I stil llike the separation of concerns even if some performance is compromised. I beleive SOC will make an application extreamley easy to maintain. But there might be (better!) ways of handling this which I’m not fully aware of.
- Limited target platforms. Only Android and iOS. Well, it’s still in beta but I wasn’t able to find anything that suggests there is going to be support for other platforms later. In fact it’s clearly mentioned that although it’s possible but there is no interest in doing so at the moment. With Xamarin you can target UWP and Mac as well as Android and iOS.
That was my first impression about Flutter.
Check out the following article if you are looking for a more in dept comparison between Flutter and Xamarin: