Flutter: What All the Fuss Is About
The Flutter SDK is Google's open-source solution for creating native mobile apps for Android and iOS.
Join the DZone community and get the full member experience.Join For Free
Flutter is Google’s open-source mobile application development SDK for crafting high-quality native applications for Android and iOS in record time. With Flutter, Google open ups a new way to build fast, attractive mobile apps that helps developers to break away from “cookie cutter” apps.
With the announcement of Flutter Release Preview 1, everyone wants to know what makes Flutter different, or the need to push all other native tools aside and focus on only one toolchain — the Flutter Platform and SDK from Google. What is new and exciting about Flutter? Why Flutter? It's a fair question, and this article is about to answer it from a technical viewpoint — not just what is exciting, but why.
Flutter is a cross-platform framework designed to address both the Android and iOS platforms. It’s based on Google’s own Dart programming language with a rendering engine based on the Skia Graphics Library, the same thing Chrome uses to draw pixels on a screen. There’s an IntelliJ IDE for Flutter, just like Google has with Android Studio. Google is also using Flutter in its upcoming Fuchsia OS.
Flutter includes a modern React-style framework, a 2D rendering engine, ready-made widgets, and development tools. These components work together to help you design, build, test, and debug apps. Everything in Flutter is organized around a few core principles.
Let’s go deeper, one aspect at a time.
The Dart Programming Language
Dart is a big reason why developers love Flutter.
Why Flutter Uses Dart
Because it matched the way they were building user interfaces.
Flutter offers fast development. Its website promises “Hot Reload in milliseconds to paint your app to life.”
Wm Leler, Senior Software Engineer at Google, further explains: “Widgets are typically accessed quite frequently (up to 60 times a second during animations, transitions, or when the user “swipes” something on the screen with their finger) so this can cause performance problems.”
Flutter has a concept called “plugins” that specifically intended to let you use existing platform libraries. Dart code talks to the OEM side that is implemented using the native library. In this way, Flutter completely bypasses the iOS and Android OEM control pipeline and draws the entire screen as a Skia canvas, with its own dart UI widgets.
Flutter fixes this issue by injecting the updated source code files into the running Dart Virtual Machine (VM). The VM updates classes with the latest versions of fields and functions. Next, the Flutter framework automatically rebuilds the widget tree. This allows to instantly view the changes that you’ve made. In Flutter, you can deploy and test an app on a device instantly. Instant change detection would multiply productivity, reduce cost, and cut down development time.
So, the hot-reload function of Flutter adds great value!
Instead of wiring up to native Android and iOS components, Flutter paints every single pixel to the screen. Flutter has pixel-perfect replications of the iOS UI and Android’s Material UI, so you can create familiar experiences in an out of the box way.
Flutter’s real power is in creating totally custom interfaces and animations. In Flutter the layouts are defined using Dart code only. There is no XML/templating language or any visual designer/storyboarding tool either.
Like other frameworks, Flutter uses reactive views and refreshes the view tree for every new frame, it creates many smooth animations and transitions that run at 60fps. Dart uses “generational garbage collection” that is very efficient for this kind of system, because objects, especially short-lived ones, are relatively cheap. In addition, allocation of objects can be done with a single pointer bump, which is fast and doesn’t require locks. This helps to avoid UI jank and stutter.
Everything Is a Widget
Widgets are critical to an app’s view and interface. They need to look good and natural irrespective of the screen size. They must perform fast, should be extensible and also customizable. Flutter makes it all possible by providing its own widgets.
Dart also has a tree shaking compiler, which only includes code that you need in your app. You can feel free to use a large library of widgets even if you only need one or two of them.
Flutter has a widget for everything and which again is a productivity booster.
The “Everything is a Widget” approach of Flutter made it easy to compose custom UIs from a rich set of building blocks provided by the framework. And, because Flutter runs on both iOS and Android, it’s easier to spend our time creating beautiful designs instead of porting the UI.
There are lot more in Flutter framework, to build apps and make them interactive.
The latest Release Preview 1 SDK is available on Flutter’s site, and users wondering what all the fuss is about can check out something from the Flutter app showcase.
Published at DZone with permission of Rohitha Elsa Philip, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.