August 21, 2024
Written by: Emina Šahinović, Engineering Manager
History repeats itself, and so does the brief history of software development. Every so often, a new development tool emerges with creators claiming that we will never have to write duplicate code again and that everything will just work seamlessly. In the past few years, Flutter seems to be the best solution so far. The fact that its popularity continues to grow even after almost five years is a testament to this. Most other tools enjoyed popularity for two to three years before being replaced by native apps or new hybrid solutions. So, what makes Flutter so popular and useful?
What goes into app development, and which parts are duplicated when developing for multiple platforms? The first and most obvious is the design of the application. If an identical or similar design is used for all platforms, it’s clear that reusing components and visual elements would be beneficial. This saves code and time while ensuring a consistent design. However, what is gained in time is lost in performance; to ensure the same code generates the same interface, the same generator must be used—in the case of applications, this is the engine. Previous hybrid development tools used a variant of the Chromium engine (a part of the web browser) to render the interface. Flutter’s advantage is that it uses its own Skia engine, which means better performance and identical rendering and logic.
Another large part of the code that gets duplicated is business logic. This involves defining and managing data, as well as setting constraints, error messages, data formatting, etc. This is also a part of the application that should behave identically across all platforms. In the simplest terms, this might be code that manages communication with the backend and defines the data schema. Some platforms and approaches offer solutions that allow this code to be shared across platforms, but these solutions are cumbersome and impractical. With Flutter, this code is shared across all platforms, ensuring faster development and simpler, more secure propagation of changes. If any data changes, updating it in one place ensures that all platforms are updated and that the changes are consistent.
The remaining code that makes sense not to duplicate includes libraries and processes—testing, building. The fact that Flutter has its own engine can also help with testing. It’s enough to validate that components and integrations pass tests within the engine. Of course, final tests need to be carried out on individual platforms, but for functional and integration tests, it’s enough to validate the components themselves. Flutter components are implemented as Widgets (similar to Components in other environments), making it very easy to validate the Widgets themselves. This also enables additional benefits such as faster updates and so-called hot reloading—changing one Widget will result in only that Widget being updated, without having to wait for the entire app to build.
If you are used to the good things about web development and want to try your hand at mobile development, Flutter is for you. If you have a simple app that collects data from a backend and displays it to the user, why not? In most such situations, Flutter will significantly speed up your development and allow you to have a ready-to-use app as quickly as possible. Unlike previous hybrid solutions, you won’t have to worry about the app's performance and speed.
Where might you hit a wall with Flutter? If your app relies heavily on native code and functionality or if you are already an experienced native developer. Developing hybrid applications requires hybrid development—knowing a bit of everything.
Android
iOS
Java
Javascript
.Net
Ruby
Python
C/C++
Flutter
Angular
Blockchain
© 2024 Klika d.o.o.