batchFutures<T> function
Implementation
Future<List<T>> batchFutures<T>(
Iterable<Future<T>> futures, {
int batchSize = 10,
}) async {
final results = <T>[];
final batches = [
for (var i = 0; i < futures.length; i += batchSize)
futures.skip(i).take(batchSize)
];
for (final batch in batches) {
final batchResults = await Future.wait(batch);
results.addAll(batchResults);
}
return results;
}