start method

Future<void> start()

Implementation

Future<void> start() async {
  if (_started != null) return;

  _log.info('[SERVER]\tSTARTING...');

  _started = Completer();

  dynamic address;
  if (ipv6) {
    address = public ? InternetAddress.anyIPv6 : InternetAddress.loopbackIPv6;
  } else {
    address = public ? InternetAddress.anyIPv4 : InternetAddress.loopbackIPv4;
  }

  _server = await HttpServer.bind(
    address,
    listenPort,
  );

  _log.info('[SERVER]\tSTARTED> port: $listenPort ; server: $_server');

  _started!.complete(true);

  _acceptLoop();
}