Still can't understand Flutter? After reading these, sooner or later you will become a big boss~

What is Flutter

insert image description here

Introduction to Flutter

Flutter is Google's mobile UI framework, which can quickly build high-quality native user interfaces on iOS and Android. One code can generate two high-performance, high-fidelity applications for iOS and Android at the same time. The goal of Flutter is to enable developers to deliver high-performance applications that feel natural and smooth across different platforms, and are compatible with differences in scrolling behavior, typography, icons, and more.

The development language of flutter is Dart. If you have used languages ​​such as Java or JavaScript, you can get started quickly. There are even some Flutter applications written by people with no programming experience! All over the world, Flutter is being used by more and more developers and organizations, and Flutter is completely free and open source.

Cross-platform self-drawing engine

Flutter is different from most other cross-platform frameworks because Flutter neither uses WebView nor native controls of the operating system. Instead, Flutter uses its own high-performance rendering engine to draw widgets. This can not only ensure the consistency of the UI on Android and iOS, but also avoid the limitations and high maintenance costs caused by the dependence on native controls.

Flutter uses Skia as its 2D rendering engine. Skia is a 2D drawing engine library. Its predecessor is a vector drawing software. Chrome and Android both use Skia as their drawing engine. Skia provides a very friendly API, and provides friendly and efficient performance in graphics conversion, text rendering, and bitmap rendering. Skia is cross-platform, so it can be embedded in Flutter's iOS SDK without having to study the closed-source Core Graphics/Core Animation of iOS.

Currently, Flutter supports iOS, Android, and Fuchsia (Google's new self-developed operating system) three mobile platforms by default. However, Flutter can also support Web development (Flutter for web) and PC development. The examples and introductions in this book are mainly based on iOS and Android platforms, and readers of other platforms can learn by themselves.

Advantages of Flutter

High development efficiency Millisecond-level hot reloading, after modification, your application interface will be updated immediately. Build native interfaces in minutes with rich, fully customizable widgets.

Expressive and flexible UI Quickly release features focused on the native experience. The layered architecture allows for complete customization, resulting in incredibly fast rendering and expressive, flexible designs.

Native performance Flutter includes many core widgets, such as scrolling, navigation, icons and fonts, etc., which can achieve the same performance as native applications on iOS and Android.
Flutter's development language

Flutter uses Dart as the development framework and widget language.

Why choose the Dart language?

Flutter was evaluated along four main dimensions, taking into account factors such as the needs of framework authors, developers, and end users. We found that different languages ​​met some requirements at different levels, but Dart scored high on all assessment dimensions and met all our requirements and standards.

The Dart runtime and compiler support a combination of two key features of Flutter:

Fast JIT-based development cycle: allows shape changes and stateful hot reloading using a typed language;

An AOT compiler that generates efficient ARM code for fast startup and predictable production deployment performance.

Additionally, the flutter development team works closely with the Dart community, which is actively dedicating resources to improving the use of Dart in Flutter. For example, when we adopted Dart, the language didn't provide a toolchain for generating native binaries (which is great for achieving predictable high performance), but it does now because the Dart team built it for Flutter. Likewise, DartVM was previously optimized for throughput, but the team is now optimizing the VM for latency, which is more important for Flutter workloads.

Dart scores high on the following key criteria:

Developer Efficiency One of Flutter's key value propositions is the savings in engineering resources by letting developers create apps for both iOS and Android using the same codebase. Using an efficient language further speeds up the development cycle and makes Flutter even more attractive. This is very important to our framework team and developers. Most of the Flutter functions are implemented in Dart, so we need to be efficient at 100,000 lines of code without sacrificing the readability of the framework and widgets.

Object-Oriented While we could use a non-OO language, that meant resolving several difficult problems. Plus, the vast majority of developers have experience with object-oriented development, so it's easier to learn how to develop with Flutter.

Predictable, high performance. With Flutter, we want to enable developers to quickly create fluid user experiences. In order to achieve this, we need to be able to run a large amount of code every animation frame. This means we need a language that provides both high performance and predictable performance, without periodic pauses that cause dropped frames.

Fast memory allocation The Flutter framework uses functional streams, which rely heavily on the underlying memory allocator, so it is very important to efficiently handle small, short-term memory allocations, so Flutter cannot be used effectively in languages ​​that lack this feature. Work.

1.1.2 Flutter framework structure

The Flutter framework is a layered structure where each layer builds on the previous one.

The goal of this design is to help you do more with less code. For example, the Material layer is built by combining basic Widgets from the Widget layer, and the Widgets layer itself is built from the lower-level Object Rendering layer.

Layers provide many options for building applications. Choose a custom approach to unleash the full expressiveness of the framework, or use the building blocks in the component layer, or mix and match. You can implement all of the out-of-the-box widgets provided by Flutter, or create your own custom widgets using the same tools and techniques that the Flutter team used to build the framework.

Nothing is hidden. You gain the development efficiency benefits from a high-level, unified widget concept without sacrificing the ability to drill down to the lower layers you wish.

The Flutter framework is divided into three layers Framework, Engine, Embedder

Flutter Framework

Framework is implemented in dart language, including UI, text, pictures, buttons and other Widgets, rendering, animation, gestures, etc. The core code of this part is the flutter package under the flutter warehouse, and the io, async, ui (dart:ui library provides the interface between the Flutter framework and the engine) and other packages under the sky_engine warehouse.

Flutter Engine

Engine is implemented in C++, mainly including: Skia, Dart and Text.

Skia is an open source two-dimensional graphics library that provides a common API for a variety of hardware and software platforms. It has been used as the graphics engine of Google Chrome, Chrome OS, Android, Mozilla Firefox, Firefox OS and many other products. The supported platforms also include Windows, macOS, iOS, Android, Ubuntu, etc.

The Dart part mainly includes: Dart Runtime, Garbage Collection (GC), if it is Debug mode, it also includes JIT (Just In Time) support. In Release and Profile modes, AOT (Ahead Of Time) is compiled into native arm code, and there is no JIT part.

Text is text rendering, and its rendering levels are as follows: libtxt library derived from Minikin (for font selection and line separation); HartBuzz is used for glyph selection and shaping; Skia is used as a rendering/GPU backend, using FreeType rendering on Android and Fuchsia , using CoreGraphics on iOS to render fonts.
Embedded

Embedder is an embedding layer through which Flutter is embedded on various platforms. The main work of Embedder includes rendering Surface settings, thread settings, and plug-ins. The platform (such as iOS) only provides a canvas, and all the remaining rendering-related logic is inside Flutter, which makes it have good cross-end consistency.

The article is reproduced in: https://baijiahao.baidu.com/sid=1677058019872815848&wfr=spider&for=pc, if there is any infringement, please contact to delete~

How to learn Flutter?

This Google open source "Introduction to Flutter and Practical Combat" hopes to help you learn Flutter in the shortest time. The tutorials are easy to understand, with rich examples, both basic knowledge and advanced skills, which can help readers quickly enter the advanced level, so bookmark it! ! !

Chapter 1, Flutter Basic Functions

insert image description here

Chapter 2, Flutter Routing Management

insert image description here

Chapter 3, Flutter network request plug-in Dio

insert image description here

Chapter 4, Flutter State Management

insert image description here

Chapter 5, Flutter animation

insert image description here

Summarize

Nowadays, many Android development positions need to master Flutter. Facing the changing employment environment, everyone hopes to master one more technology so that they will not be eliminated by the employment environment.

Friends who want to learn can click on the business card below to get this information for free~

Guess you like

Origin blog.csdn.net/Android_XG/article/details/128316795