getInfo static method

Future<ServiceProtocolInfo> getInfo()

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


static Future<ServiceProtocolInfo> getInfo() async {
  // Port to receive response from service isolate.
  final RawReceivePort receivePort =
      new RawReceivePort(null, 'Service.getInfo');
  final Completer<String?> completer = new Completer<String?>();
  receivePort.handler = (String? uriString) => completer.complete(uriString);
  // Request the information from the service isolate.
  // Await the response from the service isolate.
  String? uriString = await completer.future;
  Uri? uri = uriString == null ? null : Uri.parse(uriString);
  // Close the port.
  return new ServiceProtocolInfo(uri);