toResultEager method
Transforms an Iterable of results into a single result where the ok value is the list of all successes. If any error is encountered, the first error is used as the error result.
Implementation
Result<List<S>, F> toResultEager() {
List<S> list = [];
Result<List<S>, F> finalResult = Ok(list);
for (final result in this) {
if (result.isErr()) {
return Err(result.unwrapErr());
}
list.add(result.unwrap());
}
return finalResult;
}