Why I Ditch React Native for Flutter
January 8, 2020
Deciding between React Native and Flutter turns out to be a lot easier than I expected!
In a previous post, I talked about building my version of Google Lens because it lacked a few features that I wanted and was also not readily accessible in phones unless it was a Pixel. Fast forward a year, Google has made a lot of improvements to the app and I can also install it in all my phones (various Android & iOS).
While I was looking for ways to build the mobile app quickly, I realized it was going to take a bit more effort than a day or two. Mobile app development is something that I was always intrigued by, but never took the time to learn.
It’s about time.
Picking a framework took some time as it has to satisfy my requirements:
1 - Cross-platform (Android & iOS)
It doesn’t make sense to create a mobile app today that can only be used by some and not others. Maintaining two separate code base also doesn’t make sense for an individual or a small team of developers.
As I won’t be creating any complex games that require super-fast response time or apps that use advanced hardware features, a cross-platform framework fits the bill nicely.
One can also get around this problem by building a web app. However, I think the performance and native experience from a native app is a significant advantage over problems such as app fatigue. Progress web app might be a possible solution at some point.
2- Reputable and Trust Worthy Provider
With so many cross-platform frameworks out there, it is important to pick one that is gaining momentum, or at least it’s not showing any signs of death. No framework will last forever, but you want to pick the one that lasts long enough so you aren’t forced to migrate in the coming few years.
Google Trends of the past 5 years
3 - Large eco-system
It is hard to build any apps today that only use what’s provided in the framework. One usually makes use of various plugins/libraries that are written by other open-source developers so to speed up the development process (numpy and pandas library are what made Python so popular amongst people who work with data).
Python Scientific Ecosystem (Source: Jake VanderPlas, PyCon 2017)
4 - Modern, Lightweight & Friendly Experience
Since I’m starting from scratch, and I intend the projects that I develop to be for my personal use, I can dismiss corporate-friendly languages such as C# or Java, and look for a language and framework that provides the best experience for an indie-developer or small team.
Unfortunately, I had a lot of hiccups getting started. I followed the official tutorial and started with Expo, which is supposed to make it easier for beginners to learn RN. Unfortunately, I had problems getting it to run on my device (while it was working fine on the simulator) and it took a good night to get it to work. Debugging the infrastructure while trying to learn the framework isn’t fun.
Nonetheless, I continued coding for the next few weeks and made some good progress in getting a prototype with a few basic features to work. A major thing that bugged me is RN’s implementation that surrounds components. Everything in RN is a component, and all components are controlled by its props (properties) and state. In a component, you define the view, style and behaviour (logic) all in one place. I find this to be very confusing.
Also, everyone seems to have their state management system, and it isn’t easy for someone starting new to pick the right one. I used Redux initially but quickly I found myself wanting to switch.
During the midst of crawling along with RN, I noticed that more and more people were using Flutter, now that it has some time for people to use it after it went out of beta in Dec 2018. One drawback of Flutter is that it is made by Google. Google has a horrible history of killing products, even if there is a significant amount of people still using them.
Unfortunately, things are not all rosy with Flutter. One thing that Flutter still falls behind is its ecosystem, especially when compared to RN. For example, I was looking for integration with Stripe for payments but the plugins available at the time only provided credit card payments that require the user to input the card details each time, definitely not ready for production use.
While not everything is perfect with Flutter, it has instilled good faith in me. I watched some of Flutter Interact 2019 live and I have increasing confidence that Google will not be killing this product anytime soon. The Flutter community is also growing quickly. Flutter Web has also been making good progress and entered the Beta phase. If the current pace continues, I will be able to launch mobile, web and desktop apps with a single codebase pretty soon.