enterText method

Future<void> enterText(
  1. String text, {
  2. SettlePolicy? settlePolicy,
  3. Duration? visibleTimeout,
  4. Duration? settleTimeout,
})

Waits until this finder finds at least 1 visible widget and then enters text into it.

Example:

// enters text into the first widget having Key('email')
await $(#email).enterText(user@example.com);

If the finder finds more than 1 widget, you can choose which one to enter text into:

// enters text into the third TextField widget
await $(TextField).at(2).enterText('Code ought to be lean');

This method automatically calls WidgetTester.pumpAndSettle after entering text. If you want to disable this behavior, set settlePolicy to SettlePolicy.noSettle.

See also:

Implementation

Future<void> enterText(
  String text, {
  SettlePolicy? settlePolicy,
  Duration? visibleTimeout,
  Duration? settleTimeout,
}) async =>
    wrapWithPatrolLog(
      action: 'enterText',
      color: AnsiCodes.magenta,
      function: () => tester.enterText(
        this,
        text,
        settlePolicy: settlePolicy,
        visibleTimeout: visibleTimeout,
        settleTimeout: settleTimeout,
        enablePatrolLog: false,
      ),
    );