generate method
Write the generated code described in root
to sink
using the options
.
Implementation
@override
void generate(
StringSink sink, PigeonOptions options, Root root, FileType fileType) {
final DartOptions dartOptionsWithHeader = _dartOptionsWithCopyrightHeader(
options.dartOptions,
options.copyrightHeader,
dartOutPath: options.dartOut,
testOutPath: options.dartTestOut,
basePath: options.basePath ?? '',
);
const DartGenerator testGenerator = DartGenerator();
// The test code needs the actual package name of the Dart output, even if
// the package name has been overridden for other uses.
final String outputPackageName =
deducePackageName(options.dartOut ?? '') ?? options.getPackageName();
testGenerator.generateTest(
dartOptionsWithHeader,
root,
sink,
dartPackageName: options.getPackageName(),
dartOutputPackageName: outputPackageName,
);
}