If you are a mobile or web developer I’ll bet you heard about Flutter. Also, I’ll bet that you are React or ReactNative coder and search for a more comfortable, faster, and better (for your job) alternative.
Let's be honest, React Native not perfect… We are at npm dependency hell, have problems with hot reloading, big app size, UI performance problems, and so on. But we are on a tradeoff about fast time to market, easy to find coders (thanks to JS), and JS on backends which allow us to share team between frontend and backend.
As of React Native developers let’s take a look at the new shiny thing that will make our life more happy and easy 🙌 — Flutter.
It’s a completely different installation process compared to React Native, but it’s easy enough. Just unpack the bundle and then install the VSCode plugin (I’ll use the VSCode but there are plugins for other editors).
Flutter guys make a really, really great VSCode plugin. It has “oh my god” debugging capabilities compared to React Native. It’s like coding in Java or C and use a debugger with a lot of features out of the box. Flutter debugger has very informative errors and warnings.
Ok, we have a spin on the test app, and Wow! There are a lot faster UI compared to React native. Very smooth animations and transitions compared to RN. Changes which was made in vscode instantly updated in the simulator which delivers a really great coding experience. Yes, sometimes it hangs while hot reloading and the simulator needs to be restarted. But be honest in RN it sometimes hangs too.
One more thing, it takes an eternity for the first build compared to the expo and react native. It’s not a problem but it shows that the dart compiler can be improved in the near future.
When you first read the test app’s flutter code you’ll see that it breaks all development patterns of the last years which was stick by React. There are classes and oop instead of purely functional programming, no redux/flux patterns (Flutter introduces bloc), strong types instead of dynamic, and so on.
It’s completely different from what we are used to in the last few years.
We can talk about Flutter and Dart all day long, so let’s do some summarisation:
👍 What I liked in Flutter:
- Great VSCode plugin with out of the box debugging.
- Hot reloading works really well with great coding experience.
- Flutter is more about UI development. It is very easy and intuitive to create a great app UI out of the box, while in RN you need to choose the right UI kit, and learn it.
- Material UI widgets out of the box. You can fast create great UI if you want to use Material.
- Great forms support. I really like the paradigm with TextInputs and controllers.
- Apps UI experience is very smooth.
- App size smaller compared to RN.
👎 What I don’t like in Flutter:
- Basically, you would be stuck to MaterialUI.
- Flutter app state management, creating internal app services and even HTTP requests is more complicated than RN, because you really need to know Dart language good.
- Poor HTTP client with a lot of “syntax garbage”. Upload a picture from the camera will be a nightmare for the first time.
- Complicated app state management (https://pub.dev/packages/provider) compared to useState in RN.
- Complicated JSON serialization/deserialization, it takes 10x more time compared even to RN+TypeScrypt. I thought I’ve coded in C++… https://flutter.dev/docs/development/data-and-backend/json
- Complicated usage of Redux or MobX compared to RN, but there is bloc state management which was crafted for dart and flutter.
- Build for the web in beta and can provide some unexpected results.
- No support for certain SDKs (MongoDB Realm, etc.)
- Lack of IOS home widgets support.
- Compared to Expo you will need to take care of yourself about push notification service, over the air updates.
- I think time to market is much bigger compared to RN and Expo, but coding experience with flutter is much better (but will cost more too).
Will I go with Flutter in the near future?
I’ll definitely go with Flutter, but there are some circumstances when to use it now:
- If you tight on a budget and have a small team your better choice is JS everywhere (ReactNative + nodeJS at the backend).
- If your backend does not depend on the node (Go, Python and etc), you have (or will have) a large mobile app codebase and large mobile development team — Flutter is a winner! As of bonus, you will get a better app performance, and smooth UI even on low-end smartphones, but consider to learn your team a new language.
- Personally, I will consider using Flutter when I need MaterialUI, no push notifications, and OTA updates with rare releases cycle (some internal enterprise app for example).
Should I learn Dart?
No one knows what language would be #1 in 5 years, but for the present time, Dart is not even in the top 10 languages according to GitHub 2020 stats. But for example, TypeScript has dramatically surged for the past few years. Dart is not a new language. Google opened it to the public 9 years ago (2011), and positioned it as JS replacement and native support in Chrome browsers. But something goes wrong, and as we can see now Dart even not close to replacing the JS, but we saw WebAssembly support.
Dart language is intuitive for experienced polyglot developers, it’s like Java with C# and Swift mix. It’s easy to learn and read the code.
Personally, I would pray for the Dart to replace “the old and ugly” JS in the future 🤞. But for now, you should consider learning Dart deeply only if Flutter is your job.
There is one more thing about Flutter… Google.
Five years ago Microsoft was an “evil company” that buys all the stuff and destroys it. But time is changing. Microsoft became “an angel” for the devs because now they create or buy things and not destroy but evolve them: VScode, NativeScript, GitHub, TypeScript— they evolve a lot with Microsoft support.
But Google is a “bad partner” for the dev product.
Google is the creator and supporter of Dart and Flutter, and to be honest, it is struggling with its competitors in the devs community and dev tools. Even the google-code project was closed. Facebook with React, Microsoft with its C#, and TypeScript is far far more ahead. In my opinion, Google creates some great products for they local environment, then puts it to an open-source community and… and nothing ahead. Just “take and use it” and we are going to create the “next big thing”, support is slowing, enthusiasm is slowing. Even Go lang which was great at the start and we use it a lot a few years ago, just blown away from the top 10. And we as developers who love Go and used it a lot didn’t feel “protected and loved” compared to Python or NodeJS. And we switched to them, because of code maintainability, less time to market, and code costs.
Dart is not a new language, and Flutter shines only because react-native has some structural problems (and JS itself) and not because Google invests a lot in it.