Use FutureOr for more precise typing (#146)
This fixes some internal google usages.
diff --git a/lib/support/async.dart b/lib/support/async.dart
index 875e750..53f7245 100644
--- a/lib/support/async.dart
+++ b/lib/support/async.dart
@@ -14,7 +14,7 @@
library webdriver.support.async;
-import 'dart:async' show Completer, Future;
+import 'dart:async' show Completer, Future, FutureOr;
import 'package:matcher/matcher.dart' as m;
import 'package:stack_trace/stack_trace.dart' show Chain;
@@ -25,7 +25,7 @@
const clock = const Clock();
-Future<T> waitFor<T>(T condition(),
+Future<T> waitFor<T>(FutureOr<T> condition(),
{matcher: null,
Duration timeout: defaultTimeout,
Duration interval: defaultInterval}) =>
@@ -50,7 +50,7 @@
/// is returned. Otherwise, if [condition] throws, then that exception is
/// rethrown. If [condition] doesn't throw then an [expect] exception is
/// thrown.
- Future<T> waitFor<T>(T condition(),
+ Future<T> waitFor<T>(FutureOr<T> condition(),
{matcher: null,
Duration timeout: defaultTimeout,
Duration interval: defaultInterval}) async {
diff --git a/pubspec.yaml b/pubspec.yaml
index 4b4dab3..7241c25 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -6,7 +6,7 @@
and as such, require the use of the WebDriver remote server.
homepage: https://github.com/google/webdriver.dart
environment:
- sdk: '>=1.21.1 <2.0.0'
+ sdk: '>=1.22.0 <2.0.0'
dependencies:
archive: '^1.0.0'
matcher: '^0.12.0'