factory<T> static method

T factory<T>(
  1. dynamic values,
  2. dynamic rawValue
)

Implementation

static T factory<T>(values, rawValue) {
  assert(values is List, "The 'values' should be a list of enum cases");
  assert(values.length > 0, "The 'values' is empty");

  // other cases: String, bool
  return values.firstWhere((o) => o.rawValue == rawValue, orElse: () => null);
}