public class PlatformViewsController extends Object implements MethodChannel.MethodCallHandler
Each FlutterPluginRegistry
has a single platform views controller.
A platform views controller can be attached to at most one Flutter view.
Constructor and Description |
---|
PlatformViewsController() |
Modifier and Type | Method and Description |
---|---|
void |
attach(Context context,
TextureRegistry textureRegistry,
BinaryMessenger messenger)
Attaches this platform views controller to its input and output channels.
|
void |
detach()
Detaches this platform views controller.
|
PlatformViewRegistry |
getRegistry() |
void |
onFlutterViewDestroyed() |
void |
onMethodCall(MethodCall call,
MethodChannel.Result result)
Handles the specified method call received from Flutter.
|
void |
onPreEngineRestart() |
public void attach(Context context, TextureRegistry textureRegistry, BinaryMessenger messenger)
context
- The base context that will be passed to embedded views created by this controller.
This should be the context of the Activity hosting the Flutter application.textureRegistry
- The texture registry which provides the output textures into which the embedded views
will be rendered.messenger
- The Flutter application on the other side of this messenger drives this platform views controller.public void detach()
public PlatformViewRegistry getRegistry()
public void onFlutterViewDestroyed()
public void onPreEngineRestart()
public void onMethodCall(MethodCall call, MethodChannel.Result result)
MethodChannel.MethodCallHandler
Handler implementations must submit a result for all incoming calls, by making a single call
on the given MethodChannel.Result
callback. Failure to do so will result in lingering Flutter result
handlers. The result may be submitted asynchronously. Calls to unknown or unimplemented methods
should be handled using MethodChannel.Result.notImplemented()
.
Any uncaught exception thrown by this method will be caught by the channel implementation and logged, and an error result will be sent back to Flutter.
The handler is called on the platform thread (Android main thread). For more details see Threading in the Flutter Engine.
onMethodCall
in interface MethodChannel.MethodCallHandler
call
- A MethodCall
.result
- A MethodChannel.Result
used for submitting the result of the call.