diff --git a/lib/src/utils/promise_timeout.dart b/lib/src/utils/promise_timeout.dart index e991ecc5..435e124a 100644 --- a/lib/src/utils/promise_timeout.dart +++ b/lib/src/utils/promise_timeout.dart @@ -1,10 +1,10 @@ part of dslink.utils; -Future awaitWithTimeout(Future future, int timeoutMs, - {Function onTimeout = null, - Function onSuccessAfterTimeout = null, - Function onErrorAfterTimeout = null}) { - Completer completer = new Completer(); +Future awaitWithTimeout(Future future, int timeoutMs, + {Function onTimeout: null, + Function onSuccessAfterTimeout: null, + Function onErrorAfterTimeout: null}) { + Completer completer = new Completer(); Timer timer = new Timer(new Duration(milliseconds: timeoutMs), () { if (!completer.isCompleted) { @@ -14,7 +14,7 @@ Future awaitWithTimeout(Future future, int timeoutMs, completer.completeError(new Exception('Future timeout before complete')); } }); - future.then((T t) { + future.then((t) { if (completer.isCompleted) { if (onSuccessAfterTimeout != null) { onSuccessAfterTimeout(t);