toEnumValueString method

String? toEnumValueString()

get the String representation of the enum value, or null if the enum was not valid

Implementation

String? toEnumValueString() {
  final interfaceType = type as InterfaceType;
  final enumName = interfaceType.getDisplayString(withNullability: false);
  final enumValue = getField('_name')?.toStringValue();
  if (enumValue == null) {
    return null;
  } else {
    return '$enumName.$enumValue';
  }
}