waitForElement method Null safety

Future<Finder> waitForElement(
  1. Finder finder
)

Runs finder repeatedly until it finds one or more Elements.

Implementation

Future<Finder> waitForElement(Finder finder) async {
  if (_frameSync) {
    await _waitUntilFrame(() => SchedulerBinding.instance.transientCallbackCount == 0);
  }

  await _waitUntilFrame(() => finder.evaluate().isNotEmpty);

  if (_frameSync) {
    await _waitUntilFrame(() => SchedulerBinding.instance.transientCallbackCount == 0);
  }

  return finder;
}