resultFrom function Null safety

Result resultFrom(
  1. String? value
)

Implementation

Result resultFrom(String? value) {
  try {
    return Result.values
        .firstWhere((v) => v.toString().split(".").last == value);
  } catch (_) {
    throw ArgumentError.value(value);
  }
}