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) {
KotlinOptions kotlinOptions =
options.kotlinOptions ?? const KotlinOptions();
kotlinOptions = kotlinOptions.merge(KotlinOptions(
errorClassName: kotlinOptions.errorClassName ?? 'FlutterError',
includeErrorClass: kotlinOptions.includeErrorClass,
fileSpecificClassNameComponent:
options.kotlinOut?.split('/').lastOrNull?.split('.').firstOrNull ??
'',
copyrightHeader: options.copyrightHeader != null
? _lineReader(
path.posix.join(options.basePath ?? '', options.copyrightHeader))
: null,
));
const KotlinGenerator generator = KotlinGenerator();
generator.generate(
kotlinOptions,
root,
sink,
dartPackageName: options.getPackageName(),
);
}