text stringlengths 1 372 |
|---|
flutter, including the core principles and concepts that form its design. |
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. |
during development, flutter apps run in a VM that offers stateful hot reload of |
changes without needing a full recompile. for release, flutter apps are compiled |
directly to machine code, whether intel x64 or ARM instructions, or to |
JavaScript if targeting the web. the framework is open source, with a permissive |
BSD license, and has a thriving ecosystem of third-party packages that |
supplement the core library functionality. |
this overview is divided into a number of sections: |
<topic_end> |
<topic_start> |
architectural layers |
flutter is designed as an extensible, layered system. it exists as a series of |
independent libraries that each depend on the underlying layer. no layer has |
privileged access to the layer below, and every part of the framework level is |
designed to be optional and replaceable. |
to the underlying operating system, flutter applications are packaged in the |
same way as any other native application. a platform-specific embedder provides |
an entrypoint; coordinates with the underlying operating system for access to |
services like rendering surfaces, accessibility, and input; and manages the |
message event loop. the embedder is written in a language that is appropriate |
for the platform: currently java and c++ for android, Objective-C/Objective-C++ |
for iOS and macOS, and c++ for windows and linux. using the embedder, flutter |
code can be integrated into an existing application as a module, or the code may |
be the entire content of the application. flutter includes a number of embedders |
for common target platforms, but other embedders also |
exist. |
at the core of flutter is the flutter engine, |
which is mostly written in c++ and supports |
the primitives necessary to support all flutter applications. |
the engine is responsible for rasterizing composited scenes |
whenever a new frame needs to be painted. |
it provides the low-level implementation of flutter’s core API, |
including graphics (through impeller on iOS and coming to android, |
and skia on other platforms) text layout, |
file and network I/O, accessibility support, |
plugin architecture, and a dart runtime |
and compile toolchain. |
the engine is exposed to the flutter framework through |
dart:ui, |
which wraps the underlying c++ code in dart classes. this library |
exposes the lowest-level primitives, such as classes for driving input, |
graphics, and text rendering subsystems. |
typically, developers interact with flutter through the flutter framework, |
which provides a modern, reactive framework written in the dart language. it |
includes a rich set of platform, layout, and foundational libraries, composed of |
a series of layers. working from the bottom to the top, we have: |
the flutter framework is relatively small; many higher-level features that |
developers might use are implemented as packages, including platform plugins |
like camera and |
webview, as well as platform-agnostic |
features like characters, |
http, and |
animations that build upon the core dart and |
flutter libraries. some of these packages come from the broader ecosystem, |
covering services like in-app |
payments, apple |
authentication, and |
animations. |
the rest of this overview broadly navigates down the layers, starting with the |
reactive paradigm of UI development. then, we describe how widgets are composed |
together and converted into objects that can be rendered as part of an |
application. we describe how flutter interoperates with other code at a platform |
level, before giving a brief summary of how flutter’s web support differs from |
other targets. |
<topic_end> |
<topic_start> |
anatomy of an app |
the following diagram gives an overview of the pieces |
that make up a regular flutter app generated by flutter create. |
it shows where the flutter engine sits in this stack, |
highlights API boundaries, and identifies the repositories |
where the individual pieces live. the legend below clarifies |
some of the terminology commonly used to describe the |
pieces of a flutter app. |
dart app |
framework (source code) |
engine (source code) |
embedder (source code) |
runner |
<topic_end> |
<topic_start> |
reactive user interfaces |
on the surface, flutter is a reactive, declarative UI framework, |
in which the developer provides a mapping from application state to interface |
state, and the framework takes on the task of updating the interface at runtime |
when the application state changes. this model is inspired by |
work that came from facebook for their own react framework, |
which includes a rethinking of many traditional design principles. |
in most traditional UI frameworks, the user interface’s initial state is |
described once and then separately updated by user code at runtime, in response |
to events. one challenge of this approach is that, as the application grows in |
complexity, the developer needs to be aware of how state changes cascade |
throughout the entire UI. for example, consider the following UI: |
there are many places where the state can be changed: the color box, the hue |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.