Skip to content

[pigeon] Allow sharing FlutterError declaration across multiple Kotlin output files #142099

@eitanliu

Description

@eitanliu

Steps to reproduce

Use Pigeon Library pigeons define.
Generating two files in the same directory, Compile error with the message Redeclaration: FlutterError.

flutter pub run pigeon \
   --input pigeons/null_fields.dart \
   --dart_out lib/null_fields_pigeon.dart \
   --kotlin_out android/src/main/kotlin/NullFieldsPigeon.kt
flutter pub run pigeon \
   --input pigeons/non_null_fields.dart \
   --dart_out lib/non_null_fields_pigeon.dart \
   --kotlin_out android/src/main/kotlin/NonNullFieldsPigeon.kt

Expected results

It compiles successfully without any issues.

Actual results

> Task :app:compileDebugKotlin
e: xxx/android/app/src/main/kotlin/NonNullFieldsPigeon.kt: (42, 7): Redeclaration:
 FlutterError
e: xxx/android/app/src/main/kotlin/NullFieldsPigeon.kt: (42, 7): Redeclaration: FlutterError

Code sample

Code sample

non_null_fields.dart
null_fields.dart

Screenshots or Video

Screenshots / Video demonstration

image

Logs

Logs

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.13.9, on macOS 13.6 22G120 darwin-x64, locale
    zh-Hans-CN)
    • Flutter version 3.13.9 on channel stable at
      /Users/xxx/Library/flutter_3.13.9
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (3 months ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/xxx/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/xxx/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Community Edition (version 2023.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 76.3.4
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version unknown)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.80.0
    ✗ Unable to determine VS Code version.

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 13.6 22G120 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 119.0.6045.199

[✓] Network resources
    • All expected network resources are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectfound in release: 3.16Found to occur in 3.16found in release: 3.19Found to occur in 3.19has 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.r: fixedIssue is closed as already fixed in a newer versionteam-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