generator_tools library

Classes

DocumentCommentSpecification
Describes how to format a document comment.
EnumeratedType
A type name that is enumerated.
HostDatatype
Represents the mapping of a Dart datatype to a Host datatype.
Indent
A helper class for managing indentation, wrapping a StringSink.
Keys
Collection of keys used in dictionaries across generators.
OutputFileOptions<T>
Options for Generators that have multiple output file types.

Enums

ApiType
Enum to specify api type when generating code.
CustomTypes
All custom definable data types.
FileType
Enum to specify which file will be generated for multi-file generators

Constants

classMemberNamePrefix → const String
Prefix for class member names not defined by the user.
classNamePrefix → const String
Prefix for generated internal classes.
disallowedPrefixes → const List<String>
Prefixes that are not allowed for any names of any types or methods.
generatedCodeWarning → const String
Warning printed at the top of all generated code.
hostProxyApiPrefix → const String
Prefix for APIs generated for ProxyApi.
maximumCodecFieldKey → const int
The maximum codec enumeration allowed.
minimumCodecFieldKey → const int
Custom codecs' custom types are enumerations begin at this number to avoid collisions with the StandardMessageCodec.
pigeonVersion → const String
The current version of pigeon.
proxyApiClassNamePrefix → const String
Prefix for classes generated to use with ProxyApis.
proxyApiCodecInstanceManagerKey → const int
The dedicated key for accessing an InstanceManager in ProxyApi base codecs.
seeAlsoWarning → const String
String to be printed after getGeneratedCodeWarning()'s warning.
totalCustomCodecKeysAllowed → const int
The total number of keys allowed in the custom codec.
validTypes → const List<String>
Supported basic datatypes.
varNamePrefix → const String
Prefix for variable names not defined by the user.

Properties

debugGenerators bool
True if the generator line number should be printed out at the end of newlines.
getter/setter pair
includeVersionInGeneratedWarning bool
Whether or not to include the version in the generated warning.
getter/setter pair

Functions

addDocumentationComments(Indent indent, List<String> comments, DocumentCommentSpecification commentSpec, {List<String> generatorComments = const <String>[]}) → void
Formats documentation comments and adds them to current Indent.
addLines(Indent indent, Iterable<String> lines, {String? linePrefix}) → void
Adds the lines to indent.
asDocumentationComments(Iterable<String> comments, DocumentCommentSpecification commentSpec, {List<String> generatorComments = const <String>[]}) Iterable<String>
Formats documentation comments and adds them to current Indent.
customTypeOverflowCheck(Root root) bool
Checks if root contains enough custom types to require overflow codec tools.
deducePackageName(String mainDartFile) String?
Given the path of a Dart file, mainDartFile, the name of the package will be deduced by locating and parsing its associated pubspec.yaml.
findHighestApiRequirement<T extends Object>(Iterable<TypeDeclaration> types, {required T? onGetApiRequirement(TypeDeclaration), required Comparator<T> onCompare}) → ({TypeDeclaration type, T version})?
Find the TypeDeclaration that has the highest API requirement and its version, T.
getEnumeratedTypes(Root root) Iterable<EnumeratedType>
Return the enumerated types that must exist in the codec where the enumeration should be the key used in the buffer.
getFieldHostDatatype(NamedType field, String? builtinResolver(TypeDeclaration), {String customResolver(String)?}) HostDatatype
Calculates the HostDatatype for the provided NamedType.
getFieldsInSerializationOrder(Class classDefinition) Iterable<NamedType>
Returns an ordered list of fields to provide consistent serialization order.
getGeneratedCodeWarning() String
Warning printed at the top of all generated code.
getHostDatatype(TypeDeclaration type, String? builtinResolver(TypeDeclaration), {String customResolver(String)?}) HostDatatype
Calculates the HostDatatype for the provided TypeDeclaration.
getReferencedTypes(List<Api> apis, List<Class> classes) Map<TypeDeclaration, List<int>>
Recurses into a list of Apis and produces a list of all referenced types and an associated List of the offsets where they are found.
isVoid(TypeMirror type) bool
Returns true if type represents 'void'.
makeChannelName(Api api, Method method, String dartPackageName) String
Create the generated channel name for a method on an api.
makeChannelNameWithStrings({required String apiName, required String methodName, required String dartPackageName}) String
Create the generated channel name for a method on an api.
makeClearChannelName(String dartPackageName) String
The channel name for the clear method of the InstanceManager API.
makeRemoveStrongReferenceChannelName(String dartPackageName) String
The channel name for the removeStrongReference method of the InstanceManager API.
mergeMaps(Map<String, Object> base, Map<String, Object> modification) Map<String, Object>
Recursively merges modification into base.
readStdin() String
Read all the content from stdin to a String.
toScreamingSnakeCase(String string) String
Converts string to SCREAMING_SNAKE_CASE.
toUpperCamelCase(String text) String
Converts strings to Upper Camel Case.