Skip to content

Pigeon throws TypeError with copyrightHeader in kotlinOptions #149956

@yanshouwang

Description

@yanshouwang

Steps to reproduce

  1. Add copyrightHeader in kotlinOptions.
  2. run dart run pigeon command.

Expected results

The copyright should be generated in the generated Kotlin class.

Actual results

Throws TypeError in the console.

Code sample

Code sample
@ConfigurePigeon(
  PigeonOptions(
    kotlinOut: '...',
    kotlinOptions: KotlinOptions(
      package: '...',
      copyrightHeader: [
        'Copyright here...',
        '',
      ],
    ),
  ),
)

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
Building package executable... (1.2s)
Built pigeon:pigeon.
Unhandled exception:
type 'List<dynamic>' is not a subtype of type 'Iterable<String>?' in type cast
#0      KotlinOptions.fromMap (package:pigeon/kotlin_generator.dart:64:47)
#1      PigeonOptions.fromMap (package:pigeon/pigeon_lib.dart:353:27)
#2      Pigeon.runWithOptions (package:pigeon/pigeon_lib.dart:2258:31)
#3      Pigeon.run (package:pigeon/pigeon_lib.dart:2193:12)
#4      runCommandLine (package:pigeon/pigeon_cl.dart:14:17)
#5      main (file:///C:/Users/yanshouwang/AppData/Local/Pub/Cache/hosted/pub.dev/pigeon-20.0.1/bin/pigeon.dart:10:14)
#6      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:33)
#7      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.0, on Microsoft Windows [Version 10.0.22631.3672], locale zh-CN)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.6)
[✓] Android Studio (version 2023.3)
[✓] IntelliJ IDEA Community Edition (version 2023.1)
[✓] IntelliJ IDEA Community Edition (version 2024.1)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions