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