onStop method

  1. @override
Future<void> onStop()

Releases reception resources, allowing retries when cleanup fails.

Implementation

@override
Future<void> onStop() async {
  if (!identical(_owner, this)) return;
  _accepting = false;
  try {
    await _subscription?.cancel();
    _subscription = null;
  } finally {
    await _platform.stopListening();
  }
  // A failed stop must retain ownership until cleanup is retried.
  _owner = null;
}