connect method Null safety

Future<FlutterDriver> connect (
  1. {String dartVmServiceUrl,
  2. bool printCommunication: false,
  3. bool logCommunicationToFile: true,
  4. int isolateNumber,
  5. Pattern fuchsiaModuleTarget,
  6. Duration timeout,
  7. Map<String, dynamic> headers}

Connects to a Flutter application.

Resumes the application if it is currently paused (e.g. at a breakpoint).

dartVmServiceUrl is the URL to Dart observatory (a.k.a. VM service). If not specified, the URL specified by the VM_SERVICE_URL environment variable is used. One or the other must be specified.

printCommunication determines whether the command communication between the test and the app should be printed to stdout.

logCommunicationToFile determines whether the command communication between the test and the app should be logged to flutter_driver_commands.log.

isolateNumber determines the specific isolate to connect to. If this is left as null, will connect to the first isolate found running on dartVmServiceUrl.

fuchsiaModuleTarget specifies the pattern for determining which mod to control. When running on a Fuchsia device, either this or the environment variable FUCHSIA_MODULE_TARGET must be set (the environment variable is treated as a substring pattern). This field will be ignored if isolateNumber is set, as this is already enough information to connect to an isolate.

headers optionally specifies HTTP headers to be included in the WebSocket connection. This is only used for VMServiceFlutterDriver connections.

browser specifies which FlutterDriver implementation to use. If not speicifed or set to false, VMServiceFlutterDriver implementation will be used. Otherwise, WebFlutterDriver implementation will be used.

The return value is a future. This method never times out, though it may fail (completing with an error). A timeout can be applied by the caller using Future.timeout if necessary.


static Future<FlutterDriver> connect({
  String dartVmServiceUrl,
  bool printCommunication = false,
  bool logCommunicationToFile = true,
  int isolateNumber,
  Pattern fuchsiaModuleTarget,
  Duration timeout,
  Map<String, dynamic> headers,
}) async {
  if (Platform.environment['FLUTTER_WEB_TEST'] != null) {
    return WebFlutterDriver.connectWeb(hostUrl: dartVmServiceUrl, timeout: timeout);
  return VMServiceFlutterDriver.connect(
            dartVmServiceUrl: dartVmServiceUrl,
            printCommunication: printCommunication,
            logCommunicationToFile: logCommunicationToFile,
            isolateNumber: isolateNumber,
            fuchsiaModuleTarget: fuchsiaModuleTarget,
            headers: headers,