DartGenerator class
Class that manages all Dart code generation.
- Inheritance
-
- Object
- Generator<
DartOptions> - StructuredGenerator<
DartOptions> - DartGenerator
Constructors
- DartGenerator()
-
Instantiates a Dart Generator.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
generate(
DartOptions generatorOptions, Root root, StringSink sink, {required String dartPackageName}) → void -
Generates files for specified language with specified
generatorOptions
inherited -
generateTest(
DartOptions generatorOptions, Root root, StringSink sink, {required String dartPackageName, required String dartOutputPackageName}) → void -
Generates Dart source code for test support libraries based on the given AST
represented by
root
, outputting the code tosink
.sourceOutPath
is the path of the generated dart code to be tested.testOutPath
is where the test code will be generated. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
writeApis(
DartOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes all apis to
indent
.inherited -
writeClassDecode(
DartOptions generatorOptions, Root root, Indent indent, Class classDefinition, {required String dartPackageName}) → void -
Writes a single class decode method to
indent
.override -
writeClassEncode(
DartOptions generatorOptions, Root root, Indent indent, Class classDefinition, {required String dartPackageName}) → void -
Writes a single class encode method to
indent
.override -
writeCloseNamespace(
DartOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes code to
indent
that closes file namespace if needed.inherited -
writeDataClass(
DartOptions generatorOptions, Root root, Indent indent, Class classDefinition, {required String dartPackageName}) → void -
Writes a single data class to
indent
.override -
writeDataClasses(
DartOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes all data classes to
indent
.inherited -
writeEnum(
DartOptions generatorOptions, Root root, Indent indent, Enum anEnum, {required String dartPackageName}) → void -
Writes a single Enum to
indent
. This is needed in most generators.override -
writeEnums(
DartOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes all enums to
indent
.inherited -
writeFileImports(
DartOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes specified imports to
indent
.override -
writeFilePrologue(
DartOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Adds specified headers to
indent
.override -
writeFlutterApi(
DartOptions generatorOptions, Root root, Indent indent, AstFlutterApi api, {String channelNameFunc(Method)?, bool isMockHandler = false, required String dartPackageName}) → void -
Writes the code for host Api,
api
. Example: class FooCodec extends StandardMessageCodec {...}override -
writeGeneralUtilities(
DartOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes any necessary helper utilities to
indent
if needed.override -
writeHostApi(
DartOptions generatorOptions, Root root, Indent indent, AstHostApi api, {required String dartPackageName}) → void -
Writes the code for host Api,
api
. Example: class FooCodec extends StandardMessageCodec {...}override -
writeInstanceManager(
DartOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes the implementation of an
InstanceManager
toindent
.override -
writeInstanceManagerApi(
DartOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes the implementation of the API for the
InstanceManager
toindent
.override -
writeOpenNamespace(
DartOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes code to
indent
that opens file namespace if needed.inherited -
writeProxyApi(
DartOptions generatorOptions, Root root, Indent indent, AstProxyApi api, {required String dartPackageName}) → void -
Writes a single Proxy Api to
indent
.override -
writeProxyApiBaseCodec(
DartOptions generatorOptions, Root root, Indent indent) → void -
Writes the base codec to be used by all ProxyApis.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited