Future<ServiceProtocolInfo> controlWebServer({bool enable: false })

Control the web server that the service protocol is accessed through. The enable argument must be a boolean and is used as a toggle to enable(true) or disable(false) the web server servicing requests.

Source

static Future<ServiceProtocolInfo> controlWebServer(
    {bool enable: false}) async {
  if (enable is! bool) {
    throw new ArgumentError.value(enable,
                                  'enable',
                                  'Must be a bool');
  }
  // Port to receive response from service isolate.
  final RawReceivePort receivePort = new RawReceivePort();
  final Completer<Uri> uriCompleter = new Completer<Uri>();
  receivePort.handler = (Uri uri) => uriCompleter.complete(uri);
  // Request the information from the service isolate.
  _webServerControl(receivePort.sendPort, enable);
  // Await the response from the service isolate.
  Uri uri = await uriCompleter.future;
  // Close the port.
  receivePort.close();
  return new ServiceProtocolInfo(uri);
}