Interface PlatformView
-
public interface PlatformViewA handle to an Android view to be embedded in the Flutter hierarchy.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voiddispose()Dispose this platform view.ViewgetView()Returns the Android view to be embedded in the Flutter hierarchy.default voidonFlutterViewAttached(View flutterView)Called by theFlutterEnginethat owns thisPlatformViewwhen the AndroidViewresponsible for rendering a Flutter UI is associated with theFlutterEngine.default voidonFlutterViewDetached()Called by theFlutterEnginethat owns thisPlatformViewwhen the AndroidViewresponsible for rendering a Flutter UI is detached and disassociated from theFlutterEngine.default voidonInputConnectionLocked()Callback fired when the platform's input connection is locked, or should be used.default voidonInputConnectionUnlocked()Callback fired when the platform input connection has been unlocked.
-
-
-
Method Detail
-
getView
@Nullable View getView()
Returns the Android view to be embedded in the Flutter hierarchy.
-
onFlutterViewAttached
default void onFlutterViewAttached(@NonNull View flutterView)Called by theFlutterEnginethat owns thisPlatformViewwhen the AndroidViewresponsible for rendering a Flutter UI is associated with theFlutterEngine.This means that our associated
FlutterEnginecan now render a UI and interact with the user.Some platform views may have unusual dependencies on the
Viewthat renders Flutter UIs, such as unique keyboard interactions. ThatViewis provided here for those purposes. Use of thisViewshould be avoided if it is not absolutely necessary, because depending on thisViewwill tend to make platform view code more brittle to future changes.
-
onFlutterViewDetached
default void onFlutterViewDetached()
Called by theFlutterEnginethat owns thisPlatformViewwhen the AndroidViewresponsible for rendering a Flutter UI is detached and disassociated from theFlutterEngine.This means that our associated
FlutterEngineno longer has a rendering surface, or a user interaction surface of any kind.This platform view must release any references related to the Android
Viewthat was provided inonFlutterViewAttached(View).
-
dispose
void dispose()
Dispose this platform view.The
PlatformViewobject is unusable after this method is called.Plugins implementing
PlatformViewmust clear all references to the View object and the PlatformView after this method is called. Failing to do so will result in a memory leak.References related to the Android
Viewattached inonFlutterViewAttached(View)must be released indispose()to avoid memory leaks.
-
onInputConnectionLocked
default void onInputConnectionLocked()
Callback fired when the platform's input connection is locked, or should be used.This hook only exists for rare cases where the plugin relies on the state of the input connection. This probably doesn't need to be implemented.
-
onInputConnectionUnlocked
default void onInputConnectionUnlocked()
Callback fired when the platform input connection has been unlocked.This hook only exists for rare cases where the plugin relies on the state of the input connection. This probably doesn't need to be implemented.
-
-