How to use Flutter for Mobile App development!
Flutter is an UI toolkit for building natively compiled applications for mobile, desktop and web with a single codebase.
1- How does it work
It uses its own very efficient rendering engine, called Skia, to paint the UI so that OEM widgets are not needed anymore. In this way, the app doesn’t rely on the instruments the OS exposes to draw the interface and you can freely control each single pixel of the screen.
- Flutter produces native ARM code for the machine;
- when launched, the app loads the Flutter library. Any rendering, input or event handling, and so on, is delegated to the compiled Flutter and app code. This is much faster than having a bridge.
- A minimal Flutter app is about 4.4 MB on Android and 10.9 MB on iOS (depending on the architecture, whether it be ARM 32 or 64 bit)
The true power of Flutter lies on the fact that apps are built with their own rendering stuff and they are not constrained to paint the UI following the rules "imposed" by OEM widgets. You’re free to control the screen and manipulate every single pixel.
2- Why Flutter uses Dart
There are many reasons behind the decision made by Google to choose Dart as language for the Flutter framework. Here’s a summary of what brought them to make this choice
OOP style. The vast majority of developers have object-oriented programming skills and thus Dart would be easy to learn as it adopts most of the common OOP patterns. The developer doesn’t have to deal with a completely new way of coding; he can reuse what he already knows and integrate it with the specific details of Dart.
Performances. In order to guarantee high performances and avoid frame dropping during the execution of the app, there’s the need of a high performance and predictable language. Dart can guarantee to be very efficient and it provides a powerful memory allocator that handles small, short-lived allocations. This is perfect for Flutter’s functional-style flow.
Productivity. Flutter allows developers to write Android, iOS, web and desktop apps with a single codebase keeping the same performances, aspect and feeling in each plat- form. A highly productive language like Dart accelerates the coding process and makes the framework more attractive.
Both Flutter and Dart are developed by Google which can freely decide what to do with them listening to the community as well. If Dart was developed by another company, Google probably wouldn’t have the same freedom of choice in implementing new features and and the language couldn’t evolve at the desired pace.
Another important aspect is that Dart is strongly typed, meaning that the compiler is going to be very strict about types; you’ll have both less runtime surprises and an easier debugging process. In addition, keep in mind that Dart is a complete swiss-knife because it has built-in support for:
hot reload feature;
a package manager with mandatory documentation and the possibility to play with the code using DartPad;
DevTools, a collection of debugging and performance tools;
code documentation generator tool;
support for JIT and AOT compilation.
By owning two home-made products, Google can keep the entire projects under control and decide how to integrate them in the best way possible with quick development cycles. Dart evolves together with Flutter and as time goes by: they help each other maximizing productivity and performances.