Add PluginRegistry.Registrar#view() (flutter/engine#3900)
Sometimes, plugin instances need access to the `FlutterView`. They can currently cast the `messenger()`, but that's fragile. This adds API support for getting the view from the registry.
This commit is contained in:
@@ -289,6 +289,11 @@ public final class FlutterActivityDelegate
|
||||
return flutterView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlutterView view() {
|
||||
return flutterView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Publishes a value associated with the plugin being registered.
|
||||
*
|
||||
|
||||
@@ -6,6 +6,7 @@ package io.flutter.plugin.common;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import io.flutter.view.FlutterView;
|
||||
|
||||
/**
|
||||
* Registry used by plugins to set up interaction with Android APIs.
|
||||
@@ -73,6 +74,12 @@ public interface PluginRegistry {
|
||||
*/
|
||||
BinaryMessenger messenger();
|
||||
|
||||
/**
|
||||
* Returns the {@link FlutterView} that's instantiated by this plugin's
|
||||
* {@link #activity() activity}.
|
||||
*/
|
||||
FlutterView view();
|
||||
|
||||
/**
|
||||
* Publishes a value associated with the plugin being registered.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user