Vice President - Mobility, IoT & VR
September 27, 2017 11:55
5 min read1402 views so far!
It’s just a few months of coding with flutter provoked me to write this article. Through this article I’ll walk you through the basics and underlying concepts of flutter.
What is Flutter?
Flutter is a new cross platform mobile application SDK offered by Google which lets developers to build beautiful Android and iOS applications using a common codebase. Apps built using flutter are written in Dart language. Flutter uses modern reactive framework allowing developers to build awesome UI with native look and feel. Google says , it took React as Inspiration to develop Flutter. Flutter under the hood uses a 2D rendering engine to build all the UI elements. Thus apps built in flutter look the same on Android and iOS.
Flutter, under the hood.
Flutter is built with C, C++, Dart and Skia graphics engine. Flutter uses Dart for building components and under the hood uses Skia 2D graphics engine to bring life to code.
The framework code is written in Dart where as the engine is implemented in C++. The C or C++ code is compiled into the native code with Android NDK. On iOS the C or C++ code is AOT compiled into native code with Low Level Virtual Machine (LLVM). Flutter does not use the Original Equipment Manufacturer(OEM) Widgets, instead it uses its own set of Widgets. Flutter Widgets are actually higher order components built on top of the rendering library, where rendering library is built on top lower level animation and painting libraries.
At lowest level all the UI code uses Skia to render the application UI. Flutter runs most of its framework and application code inside a lightweight Dart VM.
Everything in flutter is a widget.
Every UI element in an app built using Flutter is a widget. Unlike most of the cross platform mobile app SDKs and libraries, Flutter does not use a markup style format for building UI. Everything that you build in flutter is a dart code. This approach makes it easier for hot reloading during development. Flutter comes with awesome material and cupertino widgets readily available which makes the developer’s day easy. Flutter came up with its own UI building system because they did not want their developers to be limited with the native UI components.
Can I run platform code while using flutter?
Yes, of course. Flutter only uses its own UI abstraction. If you wish to, you can get access to all platform services like sensors and storage. Flutter provides a wide number of platform services and APIs via readily available packages. If you wish to develop packages for your own case, Flutter provides a services library, using which a platform channel can be implemented and this can be used to call platform specific functions from Dart and vice versa.
That was awesome, what more to know about flutter?
Google is building a new operating system known as Fuchsia. You can get the preview here. It is built using Dart and thus flutter is going to be the default SDK for developing apps for Fuchsia. Though that is a way long time for google to launch its new OS, it's good to be ready for the future. Flutter uses its own gesture system allowing the developers to write custom gestures such as taps, clicks, drags etc. Flutter also provides APIs to write unit tests. So much of good stuff about flutter except the app size. A Hello World app in flutter may result in approx. 7mb. This is because of the Core engine, framework, license file, ICU data and the appcode. But that is compromisable in today's internet world. Flutter also comes with hot reload feature which reduces the pain of developers to a great extent. In addition to all these, flutter is the first and only framework that uses reactive views without JS bridge, most of its code is compiled into native code, offers full control over the UI with the widgets, provides awesome built in developer tools and much more.
Hope this article helped you gain some knowledge about flutter. All that I can say about flutter after few months of coding is “Flutter is awesome!”. It was so much fun writing code in dart and I was really moved by the flutter’s hot reload feature. Having experienced in developing mobile app in native Android and React Native, I found Flutter to be really fast to match the native experience. I’d recommend you to give flutter a try for cross platform mobile app development.