Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
io.flutter.plugin.platform.PlatformView Interface Reference
Inheritance diagram for io.flutter.plugin.platform.PlatformView:
io.flutter.plugin.platform.PlatformViewsControllerTest.CountingPlatformView

Public Member Functions

View getView ()
 
default void onFlutterViewAttached (@NonNull View flutterView)
 
default void onFlutterViewDetached ()
 
void dispose ()
 
default void onInputConnectionLocked ()
 
default void onInputConnectionUnlocked ()
 

Detailed Description

A handle to an Android view to be embedded in the Flutter hierarchy.

Definition at line 13 of file PlatformView.java.

Member Function Documentation

◆ dispose()

void io.flutter.plugin.platform.PlatformView.dispose ( )

Dispose this platform view.

The PlatformView object is unusable after this method is called.

Plugins implementing PlatformView must 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 View attached in onFlutterViewAttached(View) must be released in dispose() to avoid memory leaks.

Implemented in io.flutter.plugin.platform.PlatformViewsControllerTest.CountingPlatformView.

◆ getView()

View io.flutter.plugin.platform.PlatformView.getView ( )

Returns the Android view to be embedded in the Flutter hierarchy.

Implemented in io.flutter.plugin.platform.PlatformViewsControllerTest.CountingPlatformView.

◆ onFlutterViewAttached()

default void io.flutter.plugin.platform.PlatformView.onFlutterViewAttached ( @NonNull View  flutterView)
inline

Called by the io.flutter.embedding.engine.FlutterEngine that owns this
PlatformView
when the Android View responsible for rendering a Flutter UI is associated with the io.flutter.embedding.engine.FlutterEngine.

This means that our associated io.flutter.embedding.engine.FlutterEngine can now render a UI and interact with the user.

Some platform views may have unusual dependencies on the View that renders Flutter UIs, such as unique keyboard interactions. That View is provided here for those purposes. Use of this View should be avoided if it is not absolutely necessary, because depending on this View will tend to make platform view code more brittle to future changes.

Definition at line 34 of file PlatformView.java.

34{}

◆ onFlutterViewDetached()

default void io.flutter.plugin.platform.PlatformView.onFlutterViewDetached ( )
inline

Called by the io.flutter.embedding.engine.FlutterEngine that owns this
PlatformView
when the Android View responsible for rendering a Flutter UI is detached and disassociated from the io.flutter.embedding.engine.FlutterEngine.

This means that our associated io.flutter.embedding.engine.FlutterEngine no longer has a rendering surface, or a user interaction surface of any kind.

This platform view must release any references related to the Android View that was provided in onFlutterViewAttached(View).

Implemented in io.flutter.plugin.platform.PlatformViewsControllerTest.CountingPlatformView.

Definition at line 49 of file PlatformView.java.

49{}

◆ onInputConnectionLocked()

default void io.flutter.plugin.platform.PlatformView.onInputConnectionLocked ( )
inline

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.

Definition at line 71 of file PlatformView.java.

71{}

◆ onInputConnectionUnlocked()

default void io.flutter.plugin.platform.PlatformView.onInputConnectionUnlocked ( )
inline

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.

Definition at line 80 of file PlatformView.java.

80{}

The documentation for this interface was generated from the following file: