getUpperServices function

Either<String, List<UpperService>> getUpperServices(
  1. List services
)

Implementation

Either<String, List<UpperService>> getUpperServices(
  List<dynamic> services,
) {
  var result = <UpperService>[];
  var errors = '';
  services.forEach((element) {
    getUpperServiceFromMap(element).fold(
      (l) => errors += l,
      (r) => result.add(r),
    );
  });
  if (errors.isNotEmpty) {
    return left(errors);
  } else {
    return right(result);
  }
}