addListenerWithLifecycle method

void addListenerWithLifecycle(
  1. RaiiLifecycleAware lifecycleAware,
  2. VoidCallback onListen, {
  3. String? debugLabel,
})

Adds a listener that will be automatically removed when the lifecycleAware is disposed.

Implementation

void addListenerWithLifecycle(
  RaiiLifecycleAware lifecycleAware,
  VoidCallback onListen, {
  String? debugLabel,
}) {
  RaiiListenableListener.withLifecycle(
    lifecycleAware,
    listenable: this,
    onListen: onListen,
    debugLabel: debugLabel,
  );
}