connectWeb method Null safety
Creates a driver that uses a connection provided by the given
hostUrl
which would fallback to environment variable VM_SERVICE_URL.
Driver also depends on environment variables DRIVER_SESSION_ID,
BROWSER_SUPPORTS_TIMELINE, DRIVER_SESSION_URI, DRIVER_SESSION_SPEC,
DRIVER_SESSION_CAPABILITIES and ANDROID_CHROME_ON_EMULATOR for
configurations.
See FlutterDriver.connect for more documentation.
Implementation
static Future<FlutterDriver> connectWeb({
String? hostUrl,
bool printCommunication = false,
bool logCommunicationToFile = true,
Duration? timeout,
}) async {
hostUrl ??= Platform.environment['VM_SERVICE_URL'];
final Map<String, dynamic> settings = <String, dynamic>{
'support-timeline-action': Platform.environment['SUPPORT_TIMELINE_ACTION'] == 'true',
'session-id': Platform.environment['DRIVER_SESSION_ID'],
'session-uri': Platform.environment['DRIVER_SESSION_URI'],
'session-spec': Platform.environment['DRIVER_SESSION_SPEC'],
'android-chrome-on-emulator': Platform.environment['ANDROID_CHROME_ON_EMULATOR'] == 'true',
'session-capabilities': Platform.environment['DRIVER_SESSION_CAPABILITIES'],
};
final FlutterWebConnection connection = await FlutterWebConnection.connect
(hostUrl!, settings, timeout: timeout);
return WebFlutterDriver.connectedTo(
connection,
printCommunication: printCommunication,
logCommunicationToFile: logCommunicationToFile,
);
}