webdriver.dart
webdriver.dart copied to clipboard
`waitFor` can return `Future<T>`
Looking at this code
Future<T?> waitFor<T>(FutureOr<T> Function() condition,
{matcher,
Duration timeout = defaultTimeout,
Duration interval = defaultInterval}) =>
clock.waitFor<T>(condition,
matcher: matcher, timeout: timeout, interval: interval);
I think it can return a Future<T>; the clock.waitFor method will only return null if condition is null, which is not allowed by the waitFor signature.
Does that sound right? If so, it would be a good change to make I think as it will save a lot of null checks in callers of waitFor :) ... happy to send a PR.
Thanks!