enterText method

Future<void> enterText (
  1. Finder finder,
  2. String text
)

Give the text input widget specified by finder the focus and enter text as if it been provided by the onscreen keyboard.

The widget specified by finder must be an EditableText or have an EditableText descendant. For example find.byType(TextField) or find.byType(TextFormField), or find.byType(EditableText).

To just give finder the focus without entering any text, see showKeyboard.

Implementation

Future<void> enterText(Finder finder, String text) async {
  return TestAsyncUtils.guard<void>(() async {
    await showKeyboard(finder);
    testTextInput.enterText(text);
    await idle();
  });
}