dispose method Null safety
Implementation
Future<void> dispose() async {
if (_isDisposed) {
return;
}
ReceivePort receivePort = ReceivePort();
_sendPort.send({
"event": _CapturerEvents.CLEAR,
"sendPort": receivePort.sendPort,
});
dynamic isolateResult = await receivePort.first;
_isDisposed = true;
_checkException(isolateResult, isolate: _isolate);
_isolate.kill(priority: Isolate.immediate);
}