resolveBoth<R> method
Resolves this
and other
with resolver
.
Note that the parameter other
should be of the same Type of this
instance.
See also resolveOther.
Implementation
FutureOr<R> resolveBoth<R>(
FutureOr<T> other, FutureOr<R> Function(T val1, T val2) resolver) {
var self = this;
if (self is Future<T>) {
if (other is Future<T>) {
return self.then((v1) {
return other.then((v2) => resolver(v1, v2));
});
} else {
return self.then((v1) {
return resolver(v1, other);
});
}
} else {
if (other is Future<T>) {
return other.then((v2) => resolver(self, v2));
} else {
return resolver(self, other);
}
}
}