nameOf<T> static method

T? nameOf<T>(
  1. List<T> array,
  2. String name
)

根据名字获得枚举

Implementation

static T? nameOf<T>(List<T> array, String name) {
  for (var item in array) {
    if (EnumUtil.getEnumName(item) == name) {
      return item;
    }
  }
  return null;
}