dart_periphery icon indicating copy to clipboard operation
dart_periphery copied to clipboard

Question about sync API

Open ookami-kb opened this issue 2 years ago • 2 comments

Is there any specific reason why all the API is sync and waiting is implemented with sleep instead of await?

I'm using the library with flutter-pi and for some reason, it doesn't work great with isolates. The library calls sleep throughout the code, making UI laggy.

ookami-kb avatar Sep 26 '23 14:09 ookami-kb

I know, the lack of an isolates integration is a problem for flutter-pi. I am Java developer, and thinking like a Java developer a created a helper class to integrate isolation with help of reflection and annotation some time ago

https://github.com/pezi/dart_periphery/blob/ps/0.9.4_isolate_api/lib/src/isolate_helper.dart

But this approach was a hasty action. dart:mirrors doesn't support AOT - therefore no flutter support. This code works only inside CLI based app.

Integreation isolate code by hand works. The only way to add isolate support for this project is to uses code generators like source_gen. In the next time I will do this step.

pezi avatar Mar 01 '24 08:03 pezi

New subproject which handles isolates is available https://github.com/pezi/flutter-pi-sensor-tester

pezi avatar Jul 27 '24 07:07 pezi