enumFromString<T> function

T enumFromString<T>(
  1. Iterable<T> values,
  2. String value
)

Implementation

T enumFromString<T>(Iterable<T> values, String value) {
  return values.firstWhere(
      (type) => equalsIgnoreCase(type.toString().split(".").last, value),
      orElse: () => values.first);
}