getIndex method

int? getIndex(
  1. O? enumInstance
)

Returns the index of enumInstance.

Implementation

int? getIndex(O? enumInstance) {
  if (enumInstance == null) {
    return null;
  }

  for (var e in valuesByName.entries) {
    var value = e.value;
    if (value == enumInstance) {
      return values.indexOf(value);
    }
  }

  return null;
}