partition method

MapResultPartition<K, V> partition()

Partitions the map into a record containing two maps: one for Ok values and one for Err values.

Implementation

MapResultPartition<K, V> partition() {
  final okParts = <K, V>{};
  final errParts = <K, Err<V>>{};
  for (final entry in entries) {
    switch (entry.value) {
      case Ok(value: final v):
        okParts[entry.key] = v;
      case Err err:
        errParts[entry.key] = err.transfErr();
    }
  }
  return (okParts: okParts, errParts: errParts);
}