showKeyboard method Null safety

Future<void> showKeyboard (
  1. Finder finder

Give the text input widget specified by finder the focus, as if the onscreen keyboard had appeared.

Implies a call to pump.

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).

Tests that just need to add text to widgets like TextField or TextFormField only need to call enterText.


Future<void> showKeyboard(Finder finder) async {
  return TestAsyncUtils.guard<void>(() async {
    final EditableTextState editable = state<EditableTextState>(
        of: finder,
        matching: find.byType(EditableText),
        matchRoot: true,
    binding.focusedEditable = editable;
    await pump();