fold method
Future<S> fold<S>(Reduces a sequence of values by repeatedly applying combine
.
Source
Future<S> fold<S>(S initialValue, S combine(S previous, T element)) { _Future<S> result = new _Future<S>(); 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; }
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-async/Stream/fold.html