Package io.flutter.embedding.engine.plugins.service

# Interface ServiceAware

public interface ServiceAware
A `FlutterPlugin` that wants to know when it is running within a `Service`.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `ServiceAware.OnModeChangeListener`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onAttachedToService(ServicePluginBinding binding)`
  Callback triggered when a `ServiceAware` `FlutterPlugin` is associated with a `Service`.
  `void`
  `onDetachedFromService()`
  Callback triggered when a `ServiceAware` `FlutterPlugin` is detached from a `Service`.

- ## Method Details

  - ### onAttachedToService

    void onAttachedToService(@NonNull ServicePluginBinding binding)
    Callback triggered when a `ServiceAware` `FlutterPlugin` is associated with a `Service`.

  - ### onDetachedFromService

    void onDetachedFromService()
    Callback triggered when a `ServiceAware` `FlutterPlugin` is detached from a `Service`.

    Any `Lifecycle` listeners that were registered in `onAttachedToService(ServicePluginBinding)` should be deregistered here to avoid a possible memory leak and other side effects.