text
stringlengths
1
474
<topic_end>
<topic_start>
Performance
Platform views in Flutter come with performance trade-offs.For example, in a typical Flutter app, the Flutter UI is
composed on a dedicated raster thread.
This allows Flutter apps to be fast,
as the main platform thread is rarely blocked.When a platform view is rendered with hybrid composition,
the Flutter UI is composed from the platform thread.
The platform thread competes with other tasks
like handling OS or plugin messages.When an iOS PlatformView is on screen, the screen refresh rate is
capped at 80fps to avoid rendering janks.For complex cases, there are some techniques that can be used
to mitigate performance issues.For example, you could use a placeholder texture while an
animation is happening in Dart.
In other words, if an animation is slow while a platform view is rendered,
then consider taking a screenshot of the native view and rendering it as a texture.<topic_end>
<topic_start>
Composition limitations
There are some limitations when composing iOS Platform Views.
<topic_end>
<topic_start>iOS debugging
Due to security around
local network permissions in iOS 14 or later,
you must accept a permission dialog box to enable
Flutter debugging functionalities such as hot-reload
and DevTools.This affects debug and profile builds only and won’t
appear in release builds. You can also allow this
permission by enabling
Settings > Privacy > Local Network > Your App.
<topic_end>
<topic_start>Restore state on iOS
When a user runs a mobile app and then selects another
app to run, the first app is moved to the background,
or backgrounded. The operating system (both iOS and Android)
often kill the backgrounded app to release memory or
improve performance for the app running in the foreground.You can use the RestorationManager (and related)
classes to handle state restoration.
An iOS app requires a bit of extra setup in Xcode,
but the restoration classes otherwise work the same on
both iOS and Android.For more information, check out State restoration on Android
and the VeggieSeasons code sample.
<topic_end>
<topic_start>Linux
<topic_end>
<topic_start>
Topics
<topic_end>
<topic_start>Add Linux devtools for Flutter
To choose the guide to add Linux devtools to your Flutter configuration,
click the Getting Started path you followed.
<topic_end>
<topic_start>Building Linux apps with Flutter
This page discusses considerations unique to building
Linux apps with Flutter, including shell integration
and preparation of apps for distribution.<topic_end>
<topic_start>
Integrating with Linux
The Linux programming interface,
comprising library functions and system calls,
is designed around the C language and ABI.
Fortunately, Dart provides dart:ffi,
which is designed to enable Dart programs
to efficiently call into C libraries.
FFI provides Flutter apps with the ability to
allocate native memory with malloc or calloc,
support for pointers, structs and callbacks,
and ABI types like long and size_t.For more information about calling C libraries
from Flutter, see C interop using dart:ffi.Many apps will benefit from using a package that
wraps the underlying library
calls in a more convenient, idiomatic Dart API.
Canonical has built a series of packages
with a focus on enabling Dart and Flutter on Linux,
including support for desktop notifications,
dbus, network management, and Bluetooth.More generally, many other packages support Linux,
including common packages such as url_launcher,
shared_preferences, file_selector, and
path_provider.<topic_end>
<topic_start>
Preparing Linux apps for distribution
The executable binary can be found in your project under
build/linux/<build mode>/bundle/. Alongside your
executable binary in the bundle directory there are
two directories:In addition to these files, your application also
relies on various operating system libraries that
it’s been compiled against.
You can see the full list by running ldd
against your application. For example,
assuming you have a Flutter desktop application
called linux_desktop_test, you could inspect
the system libraries it depends upon as follows:To wrap up this application for distribution
you need to include everything in the bundle directory,
and make sure the Linux system you are installing
it on has all of the system libraries required.
This could be as simple as:For information on publishing a Linux application
to the Snap Store, see
Build and release a Linux application to the Snap Store.
<topic_end>
<topic_start>macOS
<topic_end>
<topic_start>
Topics