onStop method

  1. @override
Future<void> onStop()
override

Called when the owning ZenithContainer or ZenithRef scope is disposed/reset.

Implementation

@override
Future<void> onStop() async {
  final sub = _subscription;
  final port = _receivePort;
  final iso = _isolate;

  _subscription = null;
  _receivePort = null;
  _isolate = null;

  await sub?.cancel();
  port?.close();
  iso?.kill(priority: Isolate.immediate);
}