flattenAll<T> static method

Result<List<T>> flattenAll<T>(
  1. Iterable<Result<T>> results

Converts a sequence of results to a result of a list.

Returns either a list of values if results doesn't contain any errors, or the first error result in results.


static Result<List<T>> flattenAll<T>(Iterable<Result<T>> results) {
  var values = <T>[];
  for (var result in results) {
    if (result.isValue) {
    } else {
      return result.asError!;
  return Result<List<T>>.value(values);