W3cubDocs

/Dart 2

getInfo method

Future<ServiceProtocolInfo> getInfo ()

Get information about the service protocol (version number and Uri to access the service).

Implementation

static Future<ServiceProtocolInfo> getInfo() async {
  // 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.
  _getServerInfo(receivePort.sendPort);
  // Await the response from the service isolate.
  Uri uri = await uriCompleter.future;
  // Close the port.
  receivePort.close();
  return new ServiceProtocolInfo(uri);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-developer/Service/getInfo.html