addObserverWithLifeycle method

void addObserverWithLifeycle(
  1. RaiiLifecycleAware lifecycleAware,
  2. WidgetsBindingObserver observer, {
  3. String? debugLabel,
})

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

Implementation

void addObserverWithLifeycle(
  RaiiLifecycleAware lifecycleAware,
  WidgetsBindingObserver observer, {
  String? debugLabel,
}) {
  RaiiWidgetsBindingObserver.withLifecycle(
    lifecycleAware,
    this,
    observer,
    debugLabel: debugLabel,
  );
}