generator_tools library

Classes

DocumentCommentSpecification
Describes how to format a document comment.
EnumeratedClass
A class 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.
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 utility classes generated for ProxyApis.
generatedCodeWarning → const String
Warning printed at the top of all generated code.
instanceManagerClassName → const String
Name for the generated InstanceManager for ProxyApis.
pigeonVersion → const String
The current version of pigeon.
seeAlsoWarning → const String
String to be printed after getGeneratedCodeWarning()'s warning.
validTypes → const List<String>
Supported basic datatypes.
varNamePrefix → const String
Prefix for all local variables in methods.

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.
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.
getCodecClasses(Api api, Root root) Iterable<EnumeratedClass>
Given an Api, return the enumerated classes 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.
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.