pumpUntilFound method

Future<bool> pumpUntilFound(
  1. Finder finder, {
  2. Duration timeout = const Duration(seconds: 5),
})

Pump until a specific widget is found or timeout.

Example:

await tester.pumpUntilFound(find.text('Welcome'));

Implementation

Future<bool> pumpUntilFound(
  Finder finder, {
  Duration timeout = const Duration(seconds: 5),
}) async {
  final stopwatch = Stopwatch()..start();
  while (stopwatch.elapsed < timeout) {
    await pump(const Duration(milliseconds: 100));
    if (finder.evaluate().isNotEmpty) {
      return true;
    }
  }
  return false;
}