Package 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 | Description
    --- | ---
    `ShimPluginRegistry​(FlutterEngine flutterEngine)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | 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

          @NonNull
          public PluginRegistry.Registrar registrarFor​(@NonNull
                                                       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.
      Returns:
        A `PluginRegistry.Registrar` for receiving the registrations pertianing to the specified plugin.

    - #### hasPlugin

          public boolean hasPlugin​(@NonNull
                                   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​(@NonNull
                                              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`
      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.