2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2025-09-29 18:53:19 +00:00
This commit is contained in:
2020-01-04 17:55:09 +03:00
parent 9c15b830dd
commit f6e7a2629c
10 changed files with 123 additions and 35 deletions

View File

@@ -59,8 +59,15 @@ class AsyncReply<T> implements Future<T>
{
_resultReady = val;
}
AsyncReply<R> then<R>(FutureOr<R> onValue(T value), {Function onError})
AsyncReply<T> next(Function(T) callback)
{
then(callback);
return this;
}
AsyncReply<R> then<R>(FutureOr<R> onValue(T value), {Function onError})
{
_callbacks.add(onValue);
if (onError != null)
@@ -83,8 +90,10 @@ class AsyncReply<T> implements Future<T>
if (_resultReady)
onValue(result);
return this as AsyncReply<R>;
if (R == Null)
return null;
else
return this as AsyncReply<R>;
}
AsyncReply<T> whenComplete(FutureOr action())