destroy method

  1. @override
Future<void> destroy()

Implementation

@override
Future<void> destroy() async {
  try {
    if (_sendPort != null && _isolate != null) {
      _sendPort!.send('stop');
    } else {
      _reportDroppedPendingEvents('logger output was destroyed before ready');
      _isolate?.kill(priority: Isolate.immediate);
      if (!_exitCompleter.isCompleted) {
        _exitCompleter.complete();
      }
    }
    await _exitCompleter.future.timeout(const Duration(seconds: 5));
  } on TimeoutException {
    _isolate?.kill(priority: Isolate.immediate);
  } finally {
    _cleanUp();
  }
}