flatAndCollect<T, X> method
Implementation
Future<Response<List<T>>> flatAndCollect<T, X>(
Iterable<X> source,
Response<T> Function(X source) mapper,
) async {
var res = await this;
if (res.isError) return Responses.failure<List<T>>(res.errors);
var response = Responses.success<List<T>>([]);
for (var id in source) {
response = response.flatMap((tab) => mapper(id).map((t) => tab!.appendInPlace(t!)));
}
return response;
}