Closed raspberry-jenshen closed 1 year ago
Thank you for the kind words!
I have looked into using event channels and it is definitely possible to add support for it. Can't say if/when it could be added though.
Could you provide a link to your plugin? I am interested to see your solution.
Eventchannel support is available from klutter 2023.1.1.beta (dart 0.3.0).
Can you provide an example on how to use the EventChannel
support Klutter?
Can you provide an example on how to use the
EventChannel
support Klutter?
See the stateless-ui recipe in the cookbook.
I see. Your @Controller
annotated Kotlin class has to subclass Publisher
.
This creates an EventChannel
with the name of the controller.
The corresponding generated Dart class subclasses Subscriber
.
The recipe you mentioned has no generated android or iOS plugin classes. Is this correct?
The EventChannel
would need to be wired in the plugin native files.
The compiler plugin will generate all the boilerplate code for Android and iOS. Just run kradle build (or gradlew install -p platform) first to see it.
Wow, what a great project :)
You've done really impressive work.
What do you think about supporting streams API? It's commonly used in flutter plugins.
Kotlin multiplatform side:
fun observeLocation() : Flow<Location>
Dart side:
Stream<Location> observeLocation();
https://api.flutter.dev/flutter/services/EventChannel-class.htmlI've done it for my own plugin. Would be great to have such a feature supported by Klutter. Thanks in advance.