getInfo method Null safety

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();
  final Completer<Uri?> uriCompleter = new Completer<Uri?>();
  receivePort.handler = (Uri? uri) => uriCompleter.complete(uri);
  // Request the information from the service isolate.
  // Await the response from the service isolate.
  Uri? uri = await uriCompleter.future;
  // Close the port.
  return new ServiceProtocolInfo(uri);