text stringlengths 1 372 |
|---|
a standard, full flutter app moves to reach this state as |
soon as the app is launched. |
in an add-to-app scenario, |
this happens when you attach a FlutterEngine |
to a UI component such as by calling startActivity() |
with an intent built using FlutterActivity.withCachedEngine() |
on android. or, by presenting a FlutterViewController |
initialized by using initWithEngine: nibName: bundle: |
on iOS. |
this is also the case if a flutter UI component was launched without |
pre-warming a FlutterEngine such as with |
FlutterActivity.createDefaultIntent() on android, |
or with FlutterViewController initWithProject: nibName: bundle: |
on iOS. an implicit FlutterEngine is created in these cases. |
behind the scene, both platform’s UI components provide the |
FlutterEngine with a rendering surface such as a |
surface on android or a CAEAGLLayer or CAMetalLayer |
on iOS. |
at this point, the layer tree generated by your flutter |
program, per frame, is converted into |
OpenGL (or vulkan or metal) GPU instructions. |
<topic_end> |
<topic_start> |
memory and latency |
showing a flutter UI has a non-trivial latency cost. |
this cost can be lessened by starting the flutter engine |
ahead of time. |
the most relevant choice for add-to-app scenarios is for you |
to decide when to pre-load a FlutterEngine |
(that is, to load the flutter library, start the dart VM, |
and run entrypoint in an isolate), and what the memory and latency |
cost is of that pre-warm. you also need to know how the pre-warm |
affects the memory and latency cost of rendering a first flutter |
frame when the UI component is subsequently attached |
to that FlutterEngine. |
as of flutter v1.10.3, and testing on a low-end 2015 class device |
in release-AOT mode, pre-warming the FlutterEngine costs: |
a flutter UI can be attached during the pre-warm. |
the remaining time is joined to the time-to-first-frame latency. |
memory-wise, a cost sample (variable, |
depending on the use case) could be: |
latency-wise, |
a cost sample (variable, depending on the use case) could be: |
the FlutterEngine should be pre-warmed late enough to delay the |
memory consumption needed but early enough to avoid combining the |
flutter engine start-up time with the first frame latency of |
showing flutter. |
the exact timing depends on the app’s structure and heuristics. |
an example would be to load the flutter engine in the screen |
before the screen is drawn by flutter. |
given an engine pre-warm, the first frame cost on UI attach is: |
memory-wise, the cost is primarily the graphical memory buffer used for |
rendering and is dependent on the screen size. |
latency-wise, the cost is primarily waiting for the OS callback to provide |
flutter with a rendering surface and compiling the remaining shader programs |
that are not pre-emptively predictable. this is a one-time cost. |
when the flutter UI component is released, the UI-related memory is freed. |
this doesn’t affect the flutter state, which lives in the FlutterEngine |
(unless the FlutterEngine is also released). |
for performance details on creating more than one FlutterEngine, |
see multiple flutters. |
<topic_end> |
<topic_start> |
android studio and IntelliJ |
<topic_end> |
<topic_start> |
installation and setup |
follow the set up an editor |
instructions to install the dart and flutter plugins. |
<topic_end> |
<topic_start> |
updating the plugins |
updates to the plugins are shipped on a regular basis. |
you should be prompted in the IDE when an update is available. |
to check for updates manually: |
<topic_end> |
<topic_start> |
creating projects |
you can create a new project in one of several ways. |
<topic_end> |
<topic_start> |
creating a new project |
creating a new flutter project from the flutter starter app template |
differs between android studio and IntelliJ. |
in android studio: |
in IntelliJ: |
<topic_end> |
<topic_start> |
setting the company domain |
when creating a new app, some flutter IDE plugins ask for an |
organization name in reverse domain order, |
something like com.example. along with the name of the app, |
this is used as the package name for android, and the bundle ID for iOS |
when the app is released. if you think you might ever release this app, |
it is better to specify these now. they cannot be changed once the app |
is released. your organization name should be unique. |
<topic_end> |
<topic_start> |
opening a project from existing source code |
to open an existing flutter project: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.