Skip to content
Discussion options

You must be logged in to vote

A FletService doesn't need a BuildContext. FletBackend.of(context) is only a Provider lookup, and every Control already has a reference to that same backend:

_frames = control.backend.openDataChannel();

This works from a service's init(), and from anywhere else you have a control.

Important

On the Python side, set on_data_channel_open before super().init().
In Dart, triggerEvent("data_channel_open", ...) is only sent if Python registered a handler. A Service is sent to Flutter from inside Service.init(), so a handler set after super().init() never reaches Flutter, and the event is silently dropped. Passing the handler to the constructor also works.
I am working on improving this.

Here's …

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
4 replies
@chenjijun
Comment options

@yst-one
Comment options

@ndonkoHenri
Comment options

@chenjijun
Comment options

Comment options

You must be logged in to vote
2 replies
@yst-one
Comment options

@yst-one
Comment options

Answer selected by yst-one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants