@@ -19,7 +19,7 @@ abstract class _Completer<T> implements Completer<T> {
1919 void complete ([FutureOr <T > value]);
2020
2121 void completeError (Object error, [StackTrace stackTrace]) {
22- ArgumentError . checkNotNull ( error, " error" );
22+ error = _nonNullError ( error);
2323 if (! future._mayComplete) throw new StateError ("Future already completed" );
2424 AsyncError replacement = Zone .current.errorCallback (error, stackTrace);
2525 if (replacement != null ) {
@@ -94,8 +94,8 @@ class _FutureListener<S, T> {
9494 this .result, _FutureOnValue <S , T > onValue, Function errorCallback)
9595 : callback = onValue,
9696 errorCallback = errorCallback,
97- state = ((errorCallback == null ) ? stateThen : stateThenOnerror) |
98- stateIsAwait;
97+ state = ((errorCallback == null ) ? stateThen : stateThenOnerror)
98+ | stateIsAwait ;
9999
100100 _FutureListener .catchError (this .result, this .errorCallback, this .callback)
101101 : state = (callback == null ) ? stateCatcherror : stateCatcherrorTest;
@@ -293,7 +293,8 @@ class _Future<T> implements Future<T> {
293293 /// The system created liseners are not registered in the zone,
294294 /// and the listener is marked as being from an `await` .
295295 /// This marker is used in [_continuationFunctions] .
296- Future <E > _thenAwait <E >(FutureOr <E > f (T value), Function onError) {
296+ Future <E > _thenAwait <E >(
297+ FutureOr <E > f (T value), Function onError) {
297298 _Future <E > result = new _Future <E >();
298299 _addListener (new _FutureListener <T , E >.thenAwait (result, f, onError));
299300 return result;
@@ -811,5 +812,5 @@ Function _registerErrorHandler(Function errorHandler, Zone zone) {
811812 errorHandler,
812813 "onError" ,
813814 "Error handler must accept one Object or one Object and a StackTrace"
814- " as arguments, and return a a valid result" );
815+ " as arguments, and return a a valid result" );
815816}
0 commit comments