dispose static method
Implementation
static Future<void> dispose() async {
if (_sendPort != null) {
final receivePort = ReceivePort();
_sendPort!.send(ShutdownCommand(receivePort.sendPort));
// Wait for the isolate to confirm shutdown
await receivePort.first;
receivePort.close();
}
_sendPort = null;
_receivePort?.close();
_receivePort = null;
_initCompleter = Completer<void>();
}