start method

  1. @override
Future<void> start()
override

Starts the managed worker if it is not already running.

A redundant call from that worker's active callback is a no-op; readiness must be awaited by an external owner rather than by a startup hook itself.

Implementation

@override
Future<void> start() {
  if (_shutdownFuture != null) {
    return Future.error(StateError('Cannot start a shut down StemApp.'));
  }
  if (WorkerOperationScope.isActiveFor(worker)) return Future<void>.value();
  if (_runWorkerFuture != null) {
    return Future.error(StateError('StemApp is owned by runUntilIdle.'));
  }
  return _startFuture ??= _start();
}