start method
Starts the engine.
This method is used to start the engine and perform any necessary initialization. It returns a Future that completes when the engine has started successfully. If any error occurs during the startup process, the Future will complete with an error.
Implementation
@override
Future<void> start() async {
if (_stopCallback != null) return;
if (_startingFuture != null) {
return await _startingFuture;
}
final completer = Completer<void>();
_startingFuture = completer.future;
try {
final (endpoint, stop) = await createServer();
_endpoint = endpoint;
_stopCallback = stop;
completer.complete();
} catch (e) {
_stopCallback = null;
completer.completeError(e);
} finally {
_startingFuture = null;
}
}