Closed SaadArdati closed 2 years ago
Indeed, thanks for the feedback I'll look into this issue.
Hello, I haven't looked at this issue yet but updated the documentation with your insights.
I hope you're getting the results you wanted from Squadron ;-)
We are! It's been amazing! We did hit a huge issue where we can't reference flutter to calculate text width and height using textPainter... If you know a way around this, do tell!
We had to disable the thread and run it on the main thread instead to get it to work :(
Indeed, secondary threads are restricted in what they can do and UI stuff can only be done in the main thread. I'll think about something and will let you know. That will involve communication between your worker and the main thread, so that means adding some ovehead but it might be worth it.
One workaround is precalculating all possible sizes for a given Text, but the initial overhead was less than ideal.
That's a possibility, but I have a POC and can confirm there's a way with workers. It needs a bit of polish so I'll post some update this weekend. Text sizes will have to be calculated from the main Flutter thread anyway. You'll have to try and see if the overhead due to thread messaging is worth it.
Squadron 3.3 published and https://github.com/d-markey/squadron_sample updated with a sample for computing text size. The sample is basic and results will be visible in the browser's JavaScript console.
Squadron 3.3 published and https://github.com/d-markey/squadron_sample updated with a sample for computing text size. The sample is basic and results will be visible in the browser's JavaScript console.
You can straight up reference Flutter classes??? How is the dart js command okay with this? TextPainter relies on dart:ui which crashes when used with dart js
. It's the whole reason we pulled any dart:ui references from our impl. How is this working fine??
Reading your changes and.. WAW. I'm going to try this out and report back to you <3 This is craazyyyy
When building using
flutter build web
, the app always throws an error that it couldn't locate the worker.dart.js we created.I had to add this script in my index.html to get it to load.