extensionClassName function

String extensionClassName(
  1. FileDescriptorProto descriptor,
  2. Set<String> usedNames
)

Chooses the name of the Dart class holding top-level extensions.

Implementation

String extensionClassName(
    FileDescriptorProto descriptor, Set<String> usedNames) {
  final s = avoidInitialUnderscore(
      legalDartIdentifier(_fileNameWithoutExtension(descriptor)));
  final candidate = '${s[0].toUpperCase()}${s.substring(1)}';
  return disambiguateName(candidate, usedNames, extensionSuffixes());
}