All About Flutter

All About Flutter

Flutter is Google’s latest mobile app SDK to develop beautiful, pixel-perfect, buttery-smooth native apps for Android and iOS in record time. It integrates with your existing Android and iOS code and is used by many organizations around the world. Flutter is a cross-platform UI toolkit that is designed to allow code reuse across operating systems such as iOS and Android while also allowing applications to interface directly with underlying platform services. The goal is to enable developers to deliver high-performance apps that feel natural on different platforms, embracing differences where they exist while sharing as much code as possible.

Components

  1. Foundation : These are basic foundation classes which provide basic building blocks like animation, painting, gestures etc.

  2. Rendering : This layer is an abstraction over layout. It helps in building a tree of renderable objects. It also figures out the dirty objects in the widget tree and replaces them with new ones. similar to what React Native provides with a virtual DOM.

  3. Widgets : It provides all the widgets required to compose the layout. Each UI component in Flutter has a corresponding widget class.

  4. Material and Cupertino : These libraries convert layouts designed using widgets into Material or iOS designs.

FLUTTER ARCHITECTURE

The Flutter architecture has three layers. Each layer comprises a bunch of libraries.

  1. Framework
  2. Engine
  3. Embedder

The framework of flutter

Apart from the above components, the Flutter Framework also provides many high-level features that developers need to build apps, such as HTTP, animations, in-app payments, etc.

Flutter Engine

The Flutter Engine was created in C++. The engine provides low-level implementations of Flutter’s core APIs, including graphics, text layout, file and network I/O, accessibility support, plugin architecture, and a Dart runtime. The engine is in charge of executing the compiled Dart code on the device using the Dart runtime. Flutter's engine takes two core technologies, Skia, a 2D graphics rendering library, and Dart, a virtual machine for a garbage-collected object-oriented language, and hosts them in a shell. Different platforms have different shells; for example, we have shells for Android and iOS. We also have an embedder API, which allows Flutter's engine to be used as a library.

The shells implement platform-specific code for such things as communicating with IMEs (on-screen keyboards) and the system's application lifecycle events.

The Dart VM implements the normal Dart core libraries plus an additional library called dart:ui to provide low-level access to Skia features and the shell. The shells can also communicate directly with Dart code via Platform Channels, which bypass the engine.

The Embedder

Flutter Embedder provides the entry point for the Flutter app. It initializes the Flutter Engine and obtains threads for UI. Embedder also manages the app lifecycle and is responsible for input gestures such as mouse, keyboard, and touch. Embedder code is platform specific and written in the native platform’s language. For example, Android’s embedder is written in Java/C++, and iOS's embedder is in Objective-C/Objective-C++.