create static method

Future<IsolateDriverConnection> create(
  1. ReceivePort receivePort
)

Creates a driver connection for a worker in an isolate. Provide the receivePort attached to the SendPort that the isolate was created with.

Implementation

static Future<IsolateDriverConnection> create(ReceivePort receivePort) async {
  var receivePortIterator = StreamIterator(receivePort);
  await receivePortIterator.moveNext();
  var sendPort = receivePortIterator.current as SendPort;
  return IsolateDriverConnection._(receivePortIterator, sendPort);
}