Package io.flutter.embedding.engine.plugins.contentprovider

# Interface ContentProviderControlSurface

public interface ContentProviderControlSurface
Control surface through which a `ContentProvider` attaches to a `FlutterEngine`.

A `ContentProvider` that contains a `FlutterEngine` should coordinate itself with the `FlutterEngine`'s `ContentProviderControlSurface`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `attachToContentProvider(ContentProvider contentProvider, androidx.lifecycle.Lifecycle lifecycle)`
  Call this method from the `ContentProvider` that is running the `FlutterEngine` that is associated with this `ContentProviderControlSurface`.
  `void`
  `detachFromContentProvider()`
  Call this method from the `ContentProvider` that is attached to this `ContentProviderControlSurfaces`'s `FlutterEngine` when the `ContentProvider` is about to be destroyed.

- ## Method Details

  - ### attachToContentProvider

    void attachToContentProvider(@NonNull ContentProvider contentProvider, @NonNull androidx.lifecycle.Lifecycle lifecycle)
    Call this method from the `ContentProvider` that is running the `FlutterEngine` that is associated with this `ContentProviderControlSurface`.

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

  - ### detachFromContentProvider

    void detachFromContentProvider()
    Call this method from the `ContentProvider` that is attached to this `ContentProviderControlSurfaces`'s `FlutterEngine` when the `ContentProvider` is about to be destroyed.

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