Package io.flutter.embedding.engine.plugins.broadcastreceiver

## Interface BroadcastReceiverControlSurface

-     public interface BroadcastReceiverControlSurface

  Control surface through which a `BroadcastReceiver` attaches to a `FlutterEngine`.

  A `BroadcastReceiver` that contains a `FlutterEngine` should coordinate itself with the `FlutterEngine`'s `BroadcastReceiverControlSurface`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `attachToBroadcastReceiver​(BroadcastReceiver broadcastReceiver, androidx.lifecycle.Lifecycle lifecycle)` | Call this method from the `BroadcastReceiver` that is running the `FlutterEngine` that is associated with this `BroadcastReceiverControlSurface`.
    `void` | `detachFromBroadcastReceiver()` | Call this method from the `BroadcastReceiver` that is attached to this `BroadcastReceiverControlSurfaces`'s `FlutterEngine` when the `BroadcastReceiver` is about to be destroyed.

- - ### Method Detail

    - #### attachToBroadcastReceiver

          void attachToBroadcastReceiver​(@NonNull
                                         BroadcastReceiver broadcastReceiver,
                                         @NonNull
                                         androidx.lifecycle.Lifecycle lifecycle)

      Call this method from the `BroadcastReceiver` that is running the `FlutterEngine` that is associated with this `BroadcastReceiverControlSurface`.

      Once a `BroadcastReceiver` is created, and its associated `FlutterEngine` is executing Dart code, the `BroadcastReceiver` should invoke this method. At that point the `FlutterEngine` is considered "attached" to the `BroadcastReceiver` and all `BroadcastReceiverAware` plugins are given access to the `BroadcastReceiver`.

    - #### detachFromBroadcastReceiver

          void detachFromBroadcastReceiver()

      Call this method from the `BroadcastReceiver` that is attached to this `BroadcastReceiverControlSurfaces`'s `FlutterEngine` when the `BroadcastReceiver` is about to be destroyed.

      This method gives each `BroadcastReceiverAware` plugin an opportunity to clean up its references before the `is destroyed`.