emit method
void
emit(
- StringBuffer buffer, {
- required InspectionCache cache,
- required AppType appType,
- Set<
String> extraKeywords = const <String>{}, - InstantiatedInspectEntry? parentEntry,
override
Emits a Dart source for this entry during interface generation.
Implementation
@override
void emit(
StringBuffer buffer, {
required InspectionCache cache,
required AppType appType,
Set<String> extraKeywords = const <String>{},
InstantiatedInspectEntry? parentEntry,
}) {
buffer.writeln("/// ## $name");
emitDoc(buffer);
emitSource(buffer);
final (String returnType, Transform transform) =
_getTypeStringWithTransform(
source.signature.return_annotation,
cache: cache,
isReturnString: true,
parentEntry: parentEntry,
);
buffer.writeln("$returnType $sanitizedName(");
final Iterable<Transform> argumentsTransforms =
emitArguments(buffer, cache: cache, parentEntry: parentEntry);
buffer.writeln(") => ");
final StringBuffer callBuffer = StringBuffer()
..writeln("getFunction(\"$name\").call(");
_emitCall(callBuffer, transforms: argumentsTransforms.toList());
callBuffer.writeln(")");
buffer.write("${transform(callBuffer.toString())};");
}