callback method Null safety

  1. @override
Future<Map<String, dynamic>> callback(
  1. Map<String, String> params,
  2. IntegrationTestResults testRunner
)
override

The callback function to response the driver side input.

Provides a handshake mechanism for executing WebDriverCommands on the driver side.

Implementation

@override
Future<Map<String, dynamic>> callback(
    Map<String, String> params, IntegrationTestResults testRunner) async {
  final String command = params['command']!;
  Map<String, String> response;
  switch (command) {
    case 'request_data':
      return params['message'] == null
          ? _requestData(testRunner)
          : _requestDataWithMessage(params['message']!, testRunner);
    case 'get_health':
      response = <String, String>{'status': 'ok'};
      break;
    default:
      throw UnimplementedError('$command is not implemented');
  }
  return <String, dynamic>{
    'isError': false,
    'response': response,
  };
}