text stringlengths 1 372 |
|---|
and the platform view provides a reference to the |
UIView. for example, FLNativeView.m: |
finally, register the platform view. |
this can be done in an app or a plugin. |
for app registration, |
modify the app’s AppDelegate.m: |
for plugin registration, |
modify the main plugin file |
(for example, FLPlugin.m): |
for more information, see the API docs for: |
<topic_end> |
<topic_start> |
putting it together |
when implementing the build() method in dart, |
you can use defaultTargetPlatform |
to detect the platform, and decide which widget to use: |
<code_start> |
widget build(BuildContext context) { |
// this is used in the platform side to register the view. |
const string viewType = '<platform-view-type>'; |
// pass parameters to the platform side. |
final Map<String, dynamic> creationParams = <string, dynamic>{}; |
switch (defaulttargetplatform) { |
case TargetPlatform.android: |
// return widget on android. |
case TargetPlatform.iOS: |
// return widget on iOS. |
default: |
throw UnsupportedError('Unsupported platform view'); |
} |
} |
<code_end> |
<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> |
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, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.