Reduces a sequence of values by repeatedly applying combine
.
Source
Future/*<S>*/ fold/*<S>*/(var/*=S*/ initialValue,
/*=S*/ combine(var/*=S*/ previous, T element)) {
_Future/*<S>*/ result = new _Future/*<S>*/();
var/*=S*/ value = initialValue;
StreamSubscription subscription;
subscription = this.listen(
(T element) {
_runUserCode(
() => combine(value, element),
(/*=S*/ newValue) { value = newValue; },
_cancelAndErrorClosure(subscription, result)
);
},
onError: (e, st) {
result._completeError(e, st);
},
onDone: () {
result._complete(value);
},
cancelOnError: true);
return result;
}