You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful to have typesafe event channels in pigeon as these currently have to be created manually (and type safety has to be ensured manually).
Proposal
Automatically translate Stream getters to event channels:
@HostApi()
abstractclassVideoPlayerApi {
// The following getter represents the new feature:Stream<VideoEvent> get videoEvents;
voiddispose();
voidsetLooping(LoopingMessage msg);
voidsetVolume(VolumeMessage msg);
voidplay();
PositionMessageposition();
voidseekTo(PositionMessage msg);
voidpause();
voidsetMixWithOthers(MixWithOthersMessage msg);
}
The above example is based on #66710 where an instance of this API represents a single instance of a video player, and so the videoEvents stream would map to an event channel for a particular video player instance.
I'd love it too. A good first step would be to generate code for classes that don't appear in the @HostAPI class so that the user can manually serialize them to dicts and send them over the EventChannel.
Reacted by Ryan Heise, Michael Lazebny, Christian Navolskyi, Mohamed CHOUCHANE, Daniel Gomez, Timote Vannier, Kent Leow, Jaroslav Novotný and Tamás Barta
I guess I should have mentioned it here when I added it. Kotlin and Swift support Event Channels now. I haven't closed this issue since it hasn't been added to all languages yet. I might close it and open a new one since that will notify people that it is partially complete.
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.
Activity
ryanheise commentedon Sep 26, 2020
@gaaclarke
mirzaeiyan commentedon Jul 4, 2021
Adherentman commentedon Apr 25, 2022
gaaclarke commentedon Apr 25, 2022
No update. Just waiting for better signal that it is worth the investment to make the case to management.
claudius-kienle commentedon May 26, 2022
c15yi commentedon May 31, 2022
brianquinlan commentedon Jul 20, 2022
I'd love it too. A good first step would be to generate code for classes that don't appear in the
@HostAPIclass so that the user can manually serialize them to dicts and send them over theEventChannel.grantsavill commentedon Sep 16, 2022
stuartmorgan-g commentedon Jan 22, 2023
Please read https://github.com/flutter/flutter/wiki/Issue-hygiene#escalating-an-issue-that-has-the-wrong-priority and https://github.com/flutter/flutter/wiki/Issue-hygiene#thumbs-up-reactions for how to express interest in this feature.
18 remaining items
Abson commentedon Dec 24, 2024
tttocklll commentedon Dec 26, 2024
I discovered that this feature has been supported since version 22.7.0 🎉.
I have tried it and confirmed that it works well!
Here's an example of how we can use it:
You can refer to the official example here: https://github.com/flutter/packages/blob/main/packages/pigeon/example/README.md#event-channel-example
tarrinneal commentedon Dec 27, 2024
I guess I should have mentioned it here when I added it. Kotlin and Swift support Event Channels now. I haven't closed this issue since it hasn't been added to all languages yet. I might close it and open a new one since that will notify people that it is partially complete.
tarrinneal commentedon Dec 27, 2024
Thanks for the feedback! Let me know if you run into any issues, or features that you think it could use!
time4tea commentedon Jan 7, 2025
Thanks for this change - it is exactly what i need! - I did find a case though that would be awesome if you could take into consideration.
in case of the following pigeon
the following kotlin is generated, which is invalid - data classes must have a member, and so this should be just a class I think
stuartmorgan-g commentedon Jan 7, 2025
#160501 tracks supporting empty classes.
time4tea commentedon Jan 7, 2025
for now i am just doing this, which works - in case this is useful... while the related PR is in the pipes.
which generates
tarrinneal commentedon Jan 15, 2025
Closing as completed with flutter/packages#7892.
Support for other languages/platforms can be tracked here: #161633
github-actions commentedon Jan 29, 2025
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 -vand a minimal reproduction of the issue.