io.flutter.embedding.engine.plugins.shim

## Class ShimPluginRegistry

- java.lang.Object
- - io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry

- All Implemented Interfaces:
    PluginRegistry

      public class ShimPluginRegistry
      extends Object
      implements 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.
       FlutterEngine flutterEngine = new FlutterEngine(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`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ShimPluginRegistry(FlutterEngine flutterEngine)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `hasPlugin(String pluginKey)` Returns whether the specified plugin is known to this registry.
    `PluginRegistry.Registrar` | `registrarFor(String pluginKey)` Returns a `PluginRegistry.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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ShimPluginRegistry

          public ShimPluginRegistry(@NonNull
                                    FlutterEngine flutterEngine)

  - ### Method Detail

    - #### registrarFor

          public PluginRegistry.Registrar registrarFor(String pluginKey)

      Description copied from interface: `PluginRegistry`
      Returns a `PluginRegistry.Registrar` for receiving the registrations pertaining to the specified plugin.
      Specified by:
        `registrarFor` in interface `PluginRegistry`
      Parameters:
        `pluginKey` - a unique String identifying the plugin; typically the fully qualified name of the plugin's main class.

    - #### hasPlugin

          public boolean hasPlugin(String pluginKey)

      Description copied from interface: `PluginRegistry`
      Returns whether the specified plugin is known to this registry.
      Specified by:
        `hasPlugin` in interface `PluginRegistry`
      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

          public <T> T valuePublishedByPlugin(String pluginKey)

      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 interface `PluginRegistry`
      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.