Class ShimPluginRegistry
java.lang.Object
io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry
- All Implemented Interfaces:
PluginRegistry
A
PluginRegistry
that is shimmed to let old plugins use the new Android embedding and
plugin API behind the scenes.
The following is an example usage of ShimPluginRegistry
within a
FlutterActivity
:
// Create the FlutterEngine that will back the Flutter UI. FlutterEngineGroup group = new FlutterEngineGroup(context); FlutterEngine flutterEngine = group.createAndRunDefaultEngine(context); // Create a ShimPluginRegistry and wrap the FlutterEngine with the shim. ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine, platformViewsController); // Use the GeneratedPluginRegistrant to add every plugin that's in the pubspec. GeneratedPluginRegistrant.registerWith(shimPluginRegistry);
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.flutter.plugin.common.PluginRegistry
PluginRegistry.ActivityResultListener, PluginRegistry.NewIntentListener, PluginRegistry.PluginRegistrantCallback, PluginRegistry.Registrar, PluginRegistry.RequestPermissionsResultListener, PluginRegistry.UserLeaveHintListener, PluginRegistry.ViewDestroyListener, PluginRegistry.WindowFocusChangedListener
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether the specified plugin is known to this registry.registrarFor
(String pluginKey) Returns aPluginRegistry.Registrar
for receiving the registrations pertaining to the specified plugin.<T> T
valuePublishedByPlugin
(String pluginKey) Returns the value published by the specified plugin, if any.
-
Constructor Details
-
ShimPluginRegistry
-
-
Method Details
-
registrarFor
Description copied from interface:PluginRegistry
Returns aPluginRegistry.Registrar
for receiving the registrations pertaining to the specified plugin.- Specified by:
registrarFor
in interfacePluginRegistry
- Parameters:
pluginKey
- a unique String identifying the plugin; typically the fully qualified name of the plugin's main class.- Returns:
- A
PluginRegistry.Registrar
for receiving the registrations pertianing to the specified plugin.
-
hasPlugin
Description copied from interface:PluginRegistry
Returns whether the specified plugin is known to this registry.- Specified by:
hasPlugin
in interfacePluginRegistry
- Parameters:
pluginKey
- a unique String identifying the plugin; typically the fully qualified name of the plugin's main class.- Returns:
- true if this registry has handed out a registrar for the specified plugin.
-
valuePublishedByPlugin
Description copied from interface:PluginRegistry
Returns the value published by the specified plugin, if any.Plugins may publish a single value, such as an instance of the plugin's main class, for situations where external control or interaction is needed. Clients are expected to know the value's type.
- Specified by:
valuePublishedByPlugin
in interfacePluginRegistry
- Type Parameters:
T
- The type of the value.- Parameters:
pluginKey
- a unique String identifying the plugin; typically the fully qualified name of the plugin's main class.- Returns:
- the published value, possibly null.
-