Fix unstable template runtime renderer generation (#2915)

Fixes #2751
diff --git a/lib/src/generator/templates.runtime_renderers.dart b/lib/src/generator/templates.runtime_renderers.dart
index ce86ed9..c53e169 100644
--- a/lib/src/generator/templates.runtime_renderers.dart
+++ b/lib/src/generator/templates.runtime_renderers.dart
@@ -16059,21 +16059,19 @@
 
 const _invisibleGetters = {
   'CategoryDefinition': {
-    'hashCode',
-    'runtimeType',
-    'name',
+    'displayName',
     'documentationMarkdown',
-    'displayName'
+    'hashCode',
+    'name',
+    'runtimeType'
   },
   'CharacterLocation': {
+    'columnNumber',
     'hashCode',
-    'runtimeType',
     'lineNumber',
-    'columnNumber'
+    'runtimeType'
   },
   'ClassElement': {
-    'hashCode',
-    'runtimeType',
     'accessors',
     'allSupertypes',
     'constructors',
@@ -16082,6 +16080,7 @@
     'fields',
     'hasNonFinalField',
     'hasStaticMember',
+    'hashCode',
     'interfaces',
     'isAbstract',
     'isDartCoreObject',
@@ -16092,24 +16091,23 @@
     'methods',
     'mixins',
     'name',
+    'runtimeType',
     'superclassConstraints',
     'supertype',
     'thisType',
     'unnamedConstructor'
   },
   'CommentReferable': {
-    'scope',
+    'definingCommentReferable',
     'href',
+    'library',
     'referenceChildren',
-    'referenceParents',
     'referenceGrandparentOverrides',
     'referenceName',
-    'library',
-    'definingCommentReferable'
+    'referenceParents',
+    'scope'
   },
   'CompilationUnitElement': {
-    'hashCode',
-    'runtimeType',
     'accessors',
     'classes',
     'enclosingElement',
@@ -16117,19 +16115,20 @@
     'extensions',
     'functions',
     'hasLoadLibraryFunction',
+    'hashCode',
     'lineInfo',
     'mixins',
+    'runtimeType',
     'session',
     'topLevelVariables',
     'typeAliases',
     'types'
   },
   'ConstructorElement': {
-    'hashCode',
-    'runtimeType',
     'declaration',
     'displayName',
     'enclosingElement',
+    'hashCode',
     'isConst',
     'isDefaultConstructor',
     'isFactory',
@@ -16137,17 +16136,17 @@
     'nameEnd',
     'periodOffset',
     'redirectedConstructor',
-    'returnType'
+    'returnType',
+    'runtimeType'
   },
-  'Context': {'hashCode', 'runtimeType', 'style', 'current', 'separator'},
+  'Context': {'current', 'hashCode', 'runtimeType', 'separator', 'style'},
   'DartType': {
-    'hashCode',
-    'runtimeType',
     'alias',
     'aliasArguments',
     'aliasElement',
     'displayName',
     'element',
+    'hashCode',
     'isBottom',
     'isDartAsyncFuture',
     'isDartAsyncFutureOr',
@@ -16167,75 +16166,74 @@
     'isDynamic',
     'isVoid',
     'name',
-    'nullabilitySuffix'
+    'nullabilitySuffix',
+    'runtimeType'
   },
   'DartdocOptionContext': {
-    'hashCode',
-    'runtimeType',
-    'optionSet',
-    'context',
-    'exclude',
     'allowTools',
     'ambiguousReexportScorerMinConfidence',
     'autoIncludeDependencies',
-    'categoryOrder',
     'categories',
+    'categoryOrder',
+    'context',
     'dropTextFrom',
     'examplePathPrefix',
+    'exclude',
+    'excludeFooterVersion',
     'excludePackages',
     'flutterRoot',
+    'format',
+    'hashCode',
     'hideSdkText',
     'include',
     'includeExternal',
     'includeSource',
     'injectHtml',
-    'sanitizeHtml',
-    'excludeFooterVersion',
-    'tools',
     'inputDir',
     'linkToRemote',
     'linkToUrl',
     'nodoc',
+    'optionSet',
     'output',
     'packageMeta',
     'packageOrder',
-    'sdkDocs',
     'resourceProvider',
-    'sdkDir',
-    'showUndocumentedCategories',
-    'topLevelPackageMeta',
-    'useCategories',
-    'validateLinks',
-    'showStats',
-    'format',
-    'useBaseHref'
-  },
-  'DocumentLocation': {'hashCode', 'runtimeType', 'index'},
-  'Documentation': {
-    'hashCode',
     'runtimeType',
-    'hasExtendedDocs',
+    'sanitizeHtml',
+    'sdkDir',
+    'sdkDocs',
+    'showStats',
+    'showUndocumentedCategories',
+    'tools',
+    'topLevelPackageMeta',
+    'useBaseHref',
+    'useCategories',
+    'validateLinks'
+  },
+  'DocumentLocation': {'hashCode', 'index', 'runtimeType'},
+  'Documentation': {
     'asHtml',
     'asOneLiner',
-    'commentRefs'
+    'commentRefs',
+    'hasExtendedDocs',
+    'hashCode',
+    'runtimeType'
   },
   'DocumentationComment': {
-    'needsPrecache',
-    'documentationFrom',
     'documentationAsHtml',
-    'elementDocumentation',
     'documentationComment',
+    'documentationFrom',
+    'documentationLocal',
+    'elementDocumentation',
+    'fullyQualifiedNameWithoutLibrary',
     'hasDocumentationComment',
     'hasNodoc',
-    'sourceFileName',
-    'fullyQualifiedNameWithoutLibrary',
-    'pathContext',
     'modelElementRenderer',
-    'documentationLocal'
+    'needsPrecache',
+    'pathContext',
+    'sourceFileName'
   },
   'Element': {
-    'hashCode',
-    'runtimeType',
     'context',
     'declaration',
     'displayName',
@@ -16261,6 +16259,7 @@
     'hasVisibleForOverriding',
     'hasVisibleForTemplate',
     'hasVisibleForTesting',
+    'hashCode',
     'id',
     'isPrivate',
     'isPublic',
@@ -16273,14 +16272,14 @@
     'nameLength',
     'nameOffset',
     'nonSynthetic',
+    'runtimeType',
     'session',
     'source'
   },
   'ElementAnnotation': {
-    'hashCode',
-    'runtimeType',
     'constantEvaluationErrors',
     'element',
+    'hashCode',
     'isAlwaysThrows',
     'isDeprecated',
     'isDoNotStore',
@@ -16303,12 +16302,10 @@
     'isUseResult',
     'isVisibleForOverriding',
     'isVisibleForTemplate',
-    'isVisibleForTesting'
+    'isVisibleForTesting',
+    'runtimeType'
   },
   'ExecutableMember': {
-    'hashCode',
-    'runtimeType',
-    'isLegacy',
     'context',
     'declaration',
     'displayName',
@@ -16318,6 +16315,7 @@
     'hasDeprecated',
     'hasDoNotStore',
     'hasFactory',
+    'hasImplicitReturnType',
     'hasInternal',
     'hasIsTest',
     'hasIsTestGroup',
@@ -16334,9 +16332,19 @@
     'hasVisibleForOverriding',
     'hasVisibleForTemplate',
     'hasVisibleForTesting',
+    'hashCode',
     'id',
+    'isAbstract',
+    'isAsynchronous',
+    'isExternal',
+    'isGenerator',
+    'isLegacy',
+    'isOperator',
     'isPrivate',
     'isPublic',
+    'isSimplyBounded',
+    'isStatic',
+    'isSynchronous',
     'isSynthetic',
     'kind',
     'library',
@@ -16347,73 +16355,64 @@
     'nameLength',
     'nameOffset',
     'nonSynthetic',
+    'parameters',
+    'returnType',
+    'runtimeType',
     'session',
     'source',
     'substitution',
-    'typeParameters',
-    'hasImplicitReturnType',
-    'isAbstract',
-    'isAsynchronous',
-    'isExternal',
-    'isGenerator',
-    'isOperator',
-    'isSimplyBounded',
-    'isStatic',
-    'isSynchronous',
-    'parameters',
-    'returnType',
-    'type'
+    'type',
+    'typeParameters'
   },
   'Expression': {
     'hashCode',
-    'runtimeType',
     'inConstantContext',
     'isAssignable',
     'precedence',
+    'runtimeType',
     'staticParameterElement',
     'staticType',
     'unParenthesized'
   },
   'ExtensionElement': {
-    'hashCode',
-    'runtimeType',
     'accessors',
     'enclosingElement',
     'extendedType',
     'fields',
-    'methods'
+    'hashCode',
+    'methods',
+    'runtimeType'
   },
   'Feature': {
-    'hashCode',
-    'runtimeType',
     'featurePrefix',
-    'sortGroup',
-    'name',
+    'hashCode',
+    'isPublic',
     'linkedName',
     'linkedNameWithParameters',
-    'isPublic'
+    'name',
+    'runtimeType',
+    'sortGroup'
   },
   'FieldElement': {
-    'hashCode',
-    'runtimeType',
     'declaration',
+    'hashCode',
     'isAbstract',
     'isCovariant',
     'isEnumConstant',
     'isExternal',
-    'isStatic'
+    'isStatic',
+    'runtimeType'
   },
   'File': {
-    'hashCode',
-    'runtimeType',
     'changes',
+    'hashCode',
     'lengthSync',
-    'modificationStamp'
+    'modificationStamp',
+    'runtimeType'
   },
-  'FunctionElement': {'hashCode', 'runtimeType', 'isEntryPoint'},
+  'FunctionElement': {'hashCode', 'isEntryPoint', 'runtimeType'},
   'FunctionType': {
     'hashCode',
-    'runtimeType',
     'namedParameterTypes',
     'normalParameterNames',
     'normalParameterTypes',
@@ -16421,90 +16420,90 @@
     'optionalParameterTypes',
     'parameters',
     'returnType',
+    'runtimeType',
     'typeFormals'
   },
   'FunctionTypedElement': {
     'hashCode',
-    'runtimeType',
     'parameters',
     'returnType',
+    'runtimeType',
     'type'
   },
   'GetterSetterCombo': {
-    'enclosingElement',
-    'documentationFrom',
-    'getter',
-    'setter',
-    'annotations',
     'allAccessors',
-    'comboFeatures',
-    'isInherited',
-    'constantInitializer',
+    'annotations',
+    'arrow',
     'characterLocation',
+    'comboFeatures',
+    'constantInitializer',
     'constantValue',
-    'constantValueTruncated',
     'constantValueBase',
-    'hasPublicGetter',
-    'hasPublicSetter',
-    'isPublic',
-    'hasAccessorsWithDocs',
-    'getterSetterBothAvailable',
-    'oneLineDoc',
+    'constantValueTruncated',
     'documentationComment',
+    'documentationFrom',
+    'enclosingElement',
+    'getter',
+    'getterSetterBothAvailable',
+    'hasAccessorsWithDocs',
     'hasDocumentationComment',
-    'modelType',
-    'isCallable',
-    'hasParameters',
-    'parameters',
-    'linkedParamsNoMetadata',
     'hasExplicitGetter',
     'hasExplicitSetter',
     'hasGetter',
-    'hasNoGetterSetter',
     'hasGetterOrSetter',
-    'hasSetter',
+    'hasNoGetterSetter',
+    'hasParameters',
+    'hasPublicGetter',
     'hasPublicGetterNoSetter',
-    'arrow',
+    'hasPublicSetter',
+    'hasSetter',
+    'isCallable',
+    'isInherited',
+    'isPublic',
+    'linkedParamsNoMetadata',
+    'modelType',
+    'oneLineDoc',
+    'parameters',
     'readOnly',
     'readWrite',
-    'writeOnly',
-    'referenceChildren'
+    'referenceChildren',
+    'setter',
+    'writeOnly'
   },
   'HashMap': {'hashCode', 'runtimeType'},
   'Inheritable': {
-    'overriddenDepth',
-    'isInherited',
-    'isCovariant',
-    'features',
     'canonicalLibrary',
+    'features',
     'inheritance',
-    'overriddenElement',
-    'isOverride'
+    'isCovariant',
+    'isInherited',
+    'isOverride',
+    'overriddenDepth',
+    'overriddenElement'
   },
   'InheritanceManager3': {'hashCode', 'runtimeType'},
   'Iterable': {
+    'first',
     'hashCode',
-    'runtimeType',
-    'iterator',
-    'length',
     'isEmpty',
     'isNotEmpty',
-    'first',
+    'iterator',
     'last',
+    'length',
+    'runtimeType',
     'single'
   },
   'LibraryElement': {
-    'hashCode',
-    'runtimeType',
     'accessibleExtensions',
     'definingCompilationUnit',
     'entryPoint',
-    'exportedLibraries',
     'exportNamespace',
+    'exportedLibraries',
     'exports',
     'featureSet',
     'hasExtUri',
     'hasLoadLibraryFunction',
+    'hashCode',
     'identifier',
     'importedLibraries',
     'imports',
@@ -16519,6 +16518,7 @@
     'parts',
     'prefixes',
     'publicNamespace',
+    'runtimeType',
     'scope',
     'session',
     'topLevelElements',
@@ -16526,31 +16526,28 @@
     'typeSystem',
     'units'
   },
-  'List': {'hashCode', 'runtimeType', 'length', 'reversed'},
+  'List': {'hashCode', 'length', 'reversed', 'runtimeType'},
   'Locatable': {
-    'hashCode',
-    'runtimeType',
     'documentationFrom',
     'documentationIsLocal',
     'fullyQualifiedName',
+    'hashCode',
     'href',
-    'location'
+    'location',
+    'runtimeType'
   },
   'Map': {
-    'hashCode',
-    'runtimeType',
     'entries',
-    'keys',
-    'values',
-    'length',
-    'isEmpty',
-    'isNotEmpty'
-  },
-  'MapEntry': {'hashCode', 'runtimeType', 'key', 'value'},
-  'Member': {
     'hashCode',
+    'isEmpty',
+    'isNotEmpty',
+    'keys',
+    'length',
     'runtimeType',
-    'isLegacy',
+    'values'
+  },
+  'MapEntry': {'hashCode', 'key', 'runtimeType', 'value'},
+  'Member': {
     'context',
     'declaration',
     'displayName',
@@ -16576,7 +16573,9 @@
     'hasVisibleForOverriding',
     'hasVisibleForTemplate',
     'hasVisibleForTesting',
+    'hashCode',
     'id',
+    'isLegacy',
     'isPrivate',
     'isPublic',
     'isSynthetic',
@@ -16589,91 +16588,91 @@
     'nameLength',
     'nameOffset',
     'nonSynthetic',
+    'runtimeType',
     'session',
     'source',
     'substitution'
   },
-  'MethodElement': {'hashCode', 'runtimeType', 'declaration'},
+  'MethodElement': {'declaration', 'hashCode', 'runtimeType'},
   'ModelElementRenderer': {'hashCode', 'runtimeType'},
   'ModelNode': {
-    'hashCode',
-    'runtimeType',
     'commentRefs',
     'element',
+    'hashCode',
     'resourceProvider',
+    'runtimeType',
     'sourceCode'
   },
   'ModelObjectBuilder': {'hashCode', 'runtimeType'},
   'PackageGraph': {
-    'hashCode',
-    'runtimeType',
-    'specialClasses',
-    'allImplementorsAdded',
-    'allExtensionsAdded',
-    'documentedExtensions',
-    'allLibraries',
+    'allCanonicalModelElements',
     'allConstructedModelElements',
+    'allExtensionsAdded',
+    'allHrefs',
+    'allImplementorsAdded',
     'allInheritableElements',
-    'packageMeta',
-    'config',
-    'rendererFactory',
-    'packageMetaProvider',
-    'defaultPackage',
-    'hasEmbedderSdk',
-    'packageMap',
-    'sdk',
-    'sdkLibrarySources',
+    'allLibraries',
     'allLibrariesAdded',
-    'packageWarningCounter',
-    'publicPackages',
-    'libraries',
-    'libraryCount',
-    'publicLibraries',
-    'localPublicLibraries',
+    'allLocalModelElements',
+    'allModelElements',
+    'config',
     'dartCoreObject',
+    'defaultPackage',
+    'defaultPackageName',
+    'documentedExtensions',
+    'documentedPackages',
+    'extensions',
+    'hasEmbedderSdk',
+    'hasFooterVersion',
+    'hashCode',
+    'implementors',
     'inheritThrough',
     'invisibleAnnotations',
-    'allModelElements',
-    'allLocalModelElements',
-    'allCanonicalModelElements',
-    'referenceChildren',
-    'name',
-    'implementors',
-    'extensions',
-    'defaultPackageName',
-    'hasFooterVersion',
-    'packageGraph',
-    'resourceProvider',
-    'packages',
-    'localPackages',
-    'documentedPackages',
+    'libraries',
+    'libraryCount',
     'libraryElementReexportedBy',
-    'allHrefs',
-    'referenceParents'
+    'localPackages',
+    'localPublicLibraries',
+    'name',
+    'packageGraph',
+    'packageMap',
+    'packageMeta',
+    'packageMetaProvider',
+    'packageWarningCounter',
+    'packages',
+    'publicLibraries',
+    'publicPackages',
+    'referenceChildren',
+    'referenceParents',
+    'rendererFactory',
+    'resourceProvider',
+    'runtimeType',
+    'sdk',
+    'sdkLibrarySources',
+    'specialClasses'
   },
   'PackageMeta': {
-    'hashCode',
-    'runtimeType',
-    'dir',
-    'resourceProvider',
-    'pathContext',
-    'isSdk',
-    'needsPubGet',
-    'requiresFlutter',
-    'name',
-    'hostedAt',
-    'version',
     'description',
+    'dir',
+    'hashCode',
     'homepage',
+    'hostedAt',
+    'isSdk',
     'isValid',
-    'resolvedDir'
+    'name',
+    'needsPubGet',
+    'pathContext',
+    'requiresFlutter',
+    'resolvedDir',
+    'resourceProvider',
+    'runtimeType',
+    'version'
   },
   'ParameterElement': {
-    'hashCode',
-    'runtimeType',
     'declaration',
     'defaultValueCode',
     'hasDefaultValue',
+    'hashCode',
     'isCovariant',
     'isInitializingFormal',
     'isNamed',
@@ -16687,21 +16686,22 @@
     'name',
     'parameterKind',
     'parameters',
+    'runtimeType',
     'typeParameters'
   },
   'ParameterMember': {
-    'hashCode',
-    'runtimeType',
-    'isLegacy',
     'context',
     'declaration',
+    'defaultValueCode',
     'displayName',
     'documentationComment',
     'enclosingElement',
     'hasAlwaysThrows',
+    'hasDefaultValue',
     'hasDeprecated',
     'hasDoNotStore',
     'hasFactory',
+    'hasImplicitType',
     'hasInternal',
     'hasIsTest',
     'hasIsTestGroup',
@@ -16718,9 +16718,18 @@
     'hasVisibleForOverriding',
     'hasVisibleForTemplate',
     'hasVisibleForTesting',
+    'hashCode',
     'id',
+    'isConst',
+    'isConstantEvaluated',
+    'isCovariant',
+    'isFinal',
+    'isInitializingFormal',
+    'isLate',
+    'isLegacy',
     'isPrivate',
     'isPublic',
+    'isStatic',
     'isSynthetic',
     'kind',
     'library',
@@ -16731,41 +16740,31 @@
     'nameLength',
     'nameOffset',
     'nonSynthetic',
+    'parameterKind',
+    'parameters',
+    'runtimeType',
     'session',
     'source',
     'substitution',
-    'hasImplicitType',
-    'isConst',
-    'isConstantEvaluated',
-    'isFinal',
-    'isLate',
-    'isStatic',
     'type',
-    'typeParameters',
-    'defaultValueCode',
-    'hasDefaultValue',
-    'isCovariant',
-    'isInitializingFormal',
-    'parameterKind',
-    'parameters'
+    'typeParameters'
   },
   'ParameterizedType': {'hashCode', 'runtimeType', 'typeArguments'},
   'PropertyAccessorElement': {
-    'hashCode',
-    'runtimeType',
     'correspondingGetter',
     'correspondingSetter',
     'declaration',
     'enclosingElement',
+    'hashCode',
     'isGetter',
     'isSetter',
+    'runtimeType',
     'variable'
   },
   'Scope': {'hashCode', 'runtimeType'},
   'SdkLibrary': {
-    'hashCode',
-    'runtimeType',
     'category',
+    'hashCode',
     'isDart2JsLibrary',
     'isDocumented',
     'isImplementation',
@@ -16773,57 +16772,58 @@
     'isShared',
     'isVmLibrary',
     'path',
+    'runtimeType',
     'shortName'
   },
   'Set': {
+    'first',
     'hashCode',
-    'runtimeType',
-    'iterator',
-    'length',
     'isEmpty',
     'isNotEmpty',
-    'first',
+    'iterator',
     'last',
+    'length',
+    'runtimeType',
     'single'
   },
   'TemplateOptions': {
-    'hashCode',
-    'runtimeType',
-    'relCanonicalPrefix',
-    'toolVersion',
-    'useBaseHref',
-    'customHeaderContent',
     'customFooterContent',
-    'customInnerFooterText'
+    'customHeaderContent',
+    'customInnerFooterText',
+    'hashCode',
+    'relCanonicalPrefix',
+    'runtimeType',
+    'toolVersion',
+    'useBaseHref'
   },
   'TypeAliasElement': {
-    'hashCode',
-    'runtimeType',
     'aliasedElement',
     'aliasedType',
     'enclosingElement',
-    'name'
+    'hashCode',
+    'name',
+    'runtimeType'
   },
   'TypeParameterElement': {
-    'hashCode',
-    'runtimeType',
     'bound',
     'declaration',
     'displayName',
-    'name'
+    'hashCode',
+    'name',
+    'runtimeType'
   },
   'TypeSystem': {'hashCode', 'runtimeType'},
   'Warnable': {'element', 'enclosingElement', 'package'},
   'int': {
+    'bitLength',
     'hashCode',
-    'runtimeType',
+    'isEven',
+    'isFinite',
+    'isInfinite',
     'isNaN',
     'isNegative',
-    'isInfinite',
-    'isFinite',
-    'sign',
-    'isEven',
     'isOdd',
-    'bitLength'
+    'runtimeType',
+    'sign'
   },
 };
diff --git a/test/mustachio/foo.runtime_renderers.dart b/test/mustachio/foo.runtime_renderers.dart
index c4a0935..df7a2c1 100644
--- a/test/mustachio/foo.runtime_renderers.dart
+++ b/test/mustachio/foo.runtime_renderers.dart
@@ -550,24 +550,24 @@
 const _invisibleGetters = {
   'Object': {'hashCode', 'runtimeType'},
   'String': {
+    'codeUnits',
     'hashCode',
-    'runtimeType',
-    'length',
     'isEmpty',
     'isNotEmpty',
-    'codeUnits',
-    'runes'
+    'length',
+    'runes',
+    'runtimeType'
   },
   'int': {
+    'bitLength',
     'hashCode',
-    'runtimeType',
+    'isEven',
+    'isFinite',
+    'isInfinite',
     'isNaN',
     'isNegative',
-    'isInfinite',
-    'isFinite',
-    'sign',
-    'isEven',
     'isOdd',
-    'bitLength'
+    'runtimeType',
+    'sign'
   },
 };
diff --git a/tool/grind.dart b/tool/grind.dart
index b2f9901..5f748fb 100644
--- a/tool/grind.dart
+++ b/tool/grind.dart
@@ -1050,8 +1050,7 @@
   'src/generator/html_resources.g.dart',
   'src/generator/templates.aot_renderers_for_html.dart',
   'src/generator/templates.aot_renderers_for_md.dart',
-  // TODO(jcollins-g): https://github.com/dart-lang/dartdoc/issues/2751
-  //'src/generator/templates.runtime_renderers.dart',
+  'src/generator/templates.runtime_renderers.dart',
   'src/version.dart',
   '../test/mustachio/foo.dart',
 ].map((s) => path.joinAll(path.posix.split(s)));
diff --git a/tool/mustachio/codegen_runtime_renderer.dart b/tool/mustachio/codegen_runtime_renderer.dart
index 39b3c0e..437f683 100644
--- a/tool/mustachio/codegen_runtime_renderer.dart
+++ b/tool/mustachio/codegen_runtime_renderer.dart
@@ -587,7 +587,7 @@
     _buffer.write('const _invisibleGetters = {');
     for (var class_ in _invisibleGetters.keys.toList()..sort()) {
       _buffer.write("'$class_':");
-      var getters = _invisibleGetters[class_]!;
+      var getters = _invisibleGetters[class_]!.toList()..sort();
       _buffer.write('{${getters.map((e) => "'$e'").join(', ')}},');
     }
     _buffer.write('};');