Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support events #1

Open
nuc134r opened this issue Jul 7, 2023 · 2 comments
Open

Support events #1

nuc134r opened this issue Jul 7, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@nuc134r
Copy link
Owner

nuc134r commented Jul 7, 2023

libzt provides a way to pass a callback method that is called from background thread when an event happens.

The problem is that Dart and Flutter do not support invoking into isolate thread.

The ways to work that around:

  • Fork libzt and use Dart_Port as explained here

  • Wait for Dart team to implement calls from background threads

  • Platform channels can be used as well but must be implemented for each platform separately which is not ideal. Also Java API passes a limited set of events and data

In first two scenarios libzt must be built with ZTS_C_API_ONLY defined (build script needs a fix for that) or else Android build will use JNI callback which is just two ints.

@nuc134r nuc134r added the help wanted Extra attention is needed label Jul 7, 2023
@cbenhagen
Copy link

Asynchronous callbacks with void returns can now be done with NativeCallable.listener from Dart 3.1.

@nuc134r
Copy link
Owner Author

nuc134r commented Sep 27, 2023

Asynchronous callbacks with void returns can now be done with NativeCallable.listener from Dart 3.1.

This is great news, thank you. I hope I will find some time to finally implement it. For now I personally just poll network statuses every 50 ms or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants