close method

Future<void> close({
  1. bool force = false,
})

close http server

server.close();

Implementation

Future<void> close({bool force = false}) async {
  StrictMode.stopWatchdog();
  _native = null;
  List<NativeHttpServer> all = _open;
  _open = <NativeHttpServer>[];
  try {
    // all ports stop taking connections at the same time, also when
    // one of them waits for its open connections
    await Future.wait(<Future<void>>[
      for (HttpServer s in all) s.close(force: force).then(_ignore),
    ]);
  } finally {
    _closed();
  }
}