serve method

Future<void> serve({
  1. int? numberOfIsolates,
})

Start serve with numberOfIsolates (default: numberOfProcessors).

Await until server shutdown.

Implementation

Future<void> serve({int? numberOfIsolates}) async {
  final total = numberOfIsolates ?? Platform.numberOfProcessors;

  for (var n = 1; n < total; n += 1) {
    await Isolate.spawn(_serve, this);
  }
  await _serve(this);
}