pumpUntilFound method

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

Implementation

Future<void> pumpUntilFound(
  Finder finder, {
  Duration timeout = const Duration(seconds: 60),
}) async {
  bool timerFound = false;
  final timer = Timer(
    timeout,
    () {
      throw TimeoutException("Pump until found has timed out.");
    },
  );
  while (timerFound != true) {
    await pump();
    final found = any(finder);
    if (found) {
      timerFound = true;
    }
  }
  timer.cancel();
}