fromString<T> static method

T? fromString<T>(
  1. List<T> enumValues,
  2. String? value
)

Implementation

static T? fromString<T>(List<T> enumValues, String? value) {
  if (value == null) return null;

  return enumValues
      .singleWhereOrNull((enumItem) => EnumToString.parse(enumItem) == value);
}