flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
162.17k stars 26.65k forks source link

How to use the `ProxyApi` annotation? #147486

Closed yanshouwang closed 2 weeks ago

yanshouwang commented 2 weeks ago

What package does this bug report belong to?

pigeon

What target platforms are you seeing this bug on?

Android, iOS, macOS, Linux, Windows

Have you already upgraded your packages?

Yes

Dependency versions

pubspec.lock ```lock pigeon: dependency: "direct dev" description: name: pigeon sha256: be883401d09121c427ed9c5f6e96427787d93d335f55e5e2b0d780a0a22cd561 url: "https://pub.dev" source: hosted version: "18.0.0" ```

Steps to reproduce

I noticed there is a ProxyApi annotation in the pigeon package, seems it's a new feature to maintain instances, but after I run the dart run pigeon --input pigeon.dart command, the ProxyApi class is only generated on the Dart side, how can I use this feature correctly?

Expected results

The ProxyApi class is generated correctly on all platforms.

Actual results

The ProxyApi class is only generated on the Dart side

Code sample

Code sample ```dart // pigeon.dart @HostApi() abstract class MyCipherHostAPI { MyCipherProxyAPI getInstance(String nameArgs); } @ProxyApi() abstract class MyCipherProxyAPI { Uint8List encrypt(Uint8List dataArgs, Uint8List keyArgs); Uint8List decrypt(Uint8List dataArgs, Uint8List keyArgs); } ```

Screenshots or Videos

Screenshots / Video demonstration [Upload media here]

Logs

Logs ```console [Paste your logs here] ```

Flutter Doctor output

Doctor output ```console Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.19.5, on Microsoft Windows [Version 10.0.22621.3527], 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.7.5) [√] Android Studio (version 2023.2) [√] VS Code, 64-bit edition (version 1.88.1) [√] Connected device (4 available) [!] Network resources X A network error occurred while checking "https://maven.google.com/": 信号灯超时时间已到 ! Doctor found issues in 1 category. ```
huycozy commented 2 weeks ago

The native parts appear to be in the works. You can follow the design doc issue at https://github.com/flutter/flutter/issues/134777, Kotlin implementation at https://github.com/flutter/packages/pull/6371 and Swift implementation at https://github.com/flutter/packages/pull/6602.

Closing as a duplicate of these issues.

github-actions[bot] commented 1 day ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.