start method

Future<int> start({
  1. Duration timeout = const Duration(minutes: 5),
})

Starts the server on a random free loopback port; resolves the port.

Implementation

Future<int> start({Duration timeout = const Duration(minutes: 5)}) async {
  await close();
  _result = Completer<String?>();
  _server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
  _timer = Timer(timeout, () => _complete(null));
  _server!.listen(_handle, onDone: () => _complete(null));
  return port!;
}