resolveAllEntries method
Resolve all MapEntry entries.
Implementation
FutureOr<Iterable<MapEntry<K, V>>> resolveAllEntries() {
var self = this;
if (self is Iterable<MapEntry<K, V>> &&
_isNotFuture(K) &&
_isNotFuture(V)) {
return self;
}
var futureKeys = <FutureOr<K>>[];
var futureValues = <FutureOr<V>>[];
for (var e in self) {
futureKeys.add(e.key);
futureValues.add(e.value);
}
return futureKeys.resolveAllJoined((keys) {
return futureValues.resolveAllJoined((values) {
var entries = List.generate(values.length, (i) {
var k = keys[i];
var v = values[i];
return MapEntry(k, v);
});
return entries;
});
});
}