Closed csells closed 2 years ago
Hello Chris,
You asked for a minimal demo, here it is. The archive contains only the source code.
To try it out, create a new Flutter app (I named it "squadron_sample") and unzip the files attached.
The sample is based on Flutter's demo app, I just replaced the floating button with two buttons to test with / without workers and see the impact on the UI. The app computes 5K digits of pi (in hexadecimal) in two ways:
I have tested on Android and Web (Chrome). Dont have the tools for Windows and iOS.
In terms of architecture, you will find:
Don't hesitate to contact me if you need further help or info.
One important thing: before you can run the Web version, you will need to pre-compile the Web worker:
dart compile js .\lib\src\browser\pi_worker_browser.dart -o .\web\pi_worker_browser.dart.js -m
I haven't figured out yet how to make Flutter do this automatically.
Closing this issue, but don't hesitate to follow up should you have any comments!
For anyone interested -- I've posted the sample on https://github.com/d-markey/squadron_sample and upgraded it to Squadron 3.1 including supports for task cancellation.
nice!
I'm interested in seeing the simplest possible usage of squadron, e.g. what's the code needed to calculate 10K digits of pi (or whatever)? how do I write that in a cross-platform way across mobile, desktop and web?