Skip to content

[pigeon] Fix named arguments in methods. #140045

@schultek

Description

@schultek

Is there an existing issue for this?

There was #127719 but it appears to be implemented only for host apis and does not work with the test output.

What package does this bug report belong to?

pigeon

What target platforms are you seeing this bug on?

Android, iOS, Web, macOS, Linux, Windows

Have you already upgraded your packages?

Yes

Dependency versions

pubspec.lock
  pigeon:
    dependency: "direct dev"
    description:
      name: pigeon
      sha256: "4d73d2649a005cc2cb0578c3c56b396a1c427879a4953fe03f45d74167042cf3"
      url: "https://pub.dev"
    source: hosted
    version: "14.0.1"

Steps to reproduce

Configure pigeon with the following input file:

import 'package:pigeon/pigeon.dart';

@ConfigurePigeon(PigeonOptions(
  dartOut: 'lib/out.dart',
  dartTestOut: 'test/out.dart',
))
@HostApi(dartHostTestHandler: "TestSomeHostApi")
abstract class SomeHostApi {
  void someMethod({required String someParam});
}

@FlutterApi()
abstract class SomeFlutterApi {
  void someMethod({required String someParam});
}

Run dart run pigeon --input input.dart

Expected results

Pigeon generates valid dart code.

Actual results

For the dart implementation of the flutter api, pigeon generates invalid dart code:

Bildschirmfoto 2023-12-13 um 11 18 59

For the dart test implementation of the host api, pigeon also generates invalid dart code:

Bildschirmfoto 2023-12-13 um 11 19 53

Code sample

See code above.

Screenshots or Videos

No response

Logs

No response

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.1 23B74 darwin-arm64, locale de-DE)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.4)
[✓] VS Code (version 1.84.1)
[✓] Connected device (2 available)
    ! Error: Browsing on the local area network for iPhone de Konstantin. Ensure the device is unlocked and attached with a cable or associated with the same local area
      network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    found in release: 3.16Found to occur in 3.16found in release: 3.18Found to occur in 3.18has 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 team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions