generate method

  1. @override
void generate(
  1. StringSink sink,
  2. PigeonOptions options,
  3. Root root,
  4. FileType fileType,
)
override

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,
    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(),
  );
}