enterTextByText method

Future<Response> enterTextByText(
  1. String text,
  2. String widgetText
)

Implementation

Future<Response> enterTextByText(String text, String widgetText) async {
  VM vm = await vmService.getVM();
  IsolateRef? mainIsolate = vm.isolates!.first;

  // First tap the widget
  await vmService.callServiceExtension(
    'ext.flutter.driver',
    isolateId: mainIsolate.id!,
    args: {
      'command': 'tap',
      'finderType': 'ByText',
      'text': widgetText,
    },
  );

  // Then enter text
  return await vmService.callServiceExtension(
    'ext.flutter.driver',
    isolateId: mainIsolate.id!,
    args: {
      'command': 'enter_text',
      'text': text,
    },
  );
}