messageOrEnumClassName function

String messageOrEnumClassName(
  1. String descriptorName,
  2. Set<String> usedNames, {
  3. String parent = '',
})

Chooses the name of the Dart class to generate for a proto message or enum.

For a nested message or enum, parent should be provided with the name of the Dart class for the immediate parent.

Implementation

String messageOrEnumClassName(String descriptorName, Set<String> usedNames,
    {String parent = ''}) {
  if (parent != '') {
    descriptorName = '${parent}_$descriptorName';
  }
  return disambiguateName(
      avoidInitialUnderscore(descriptorName), usedNames, defaultSuffixes());
}