init static method
Initializes the dispatcher and spawns the isolate.
Implementation
static Future<void> init() async {
if (_sendPort != null || _isInitializing) return;
_isInitializing = true;
_receivePort = ReceivePort();
await Isolate.spawn(_logIsolateEntry, _receivePort!.sendPort);
_sendPort = await _receivePort!.first;
_isInitializing = false;
if (!_initCompleter.isCompleted) {
_initCompleter.complete();
}
// Flush buffer
for (final command in _buffer) {
_sendPort!.send(command);
}
_buffer.clear();
}