close method

Future<void> close()

Closes the server

Implementation

Future<void> close() async {
  if (_servers == null) {
    return;
  }

  dynamic err;
  for (HttpServer server in _servers!) {
    try {
      await server.close(force: true);
    } catch (e) {
      if (err == null) err = e;
    }
  }
  _servers = null;
  if (err != null) {
    throw err;
  }
}