webdriver.dart icon indicating copy to clipboard operation
webdriver.dart copied to clipboard

`waitFor` can return `Future<T>`

Open davidmorgan opened this issue 3 years ago • 0 comments

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!

davidmorgan avatar May 18 '22 13:05 davidmorgan