tryMap<S, F extends Object> method
A fallible function f applied to each element on this array in order to return an array the same size as this or the first error encountered.
Implementation
Result<Arr<S>, F> tryMap<S, F extends Object>(Result<S, F> Function(T) f) {
List<S?> result = List.filled(_list.length, null, growable: false);
for (int i = 0; i < _list.length; i++) {
var res = f(_list[i]);
if (res case Err()) {
return res.into();
}
result[i] = res.unwrap();
}
return Ok(Arr._(result.cast<S>()));
}