describeEnum function

String describeEnum(
  1. Object enumEntry
)

Return only name of enum case, enum.name.toString() returns 'enum.name' describeEnum(enum.name) return 'name'

Implementation

String describeEnum(Object enumEntry) {
  final String description = enumEntry.toString();
  final int indexOfDot = description.indexOf('.');
  assert(indexOfDot != -1 && indexOfDot < description.length - 1);
  return description.substring(indexOfDot + 1);
}