isolate_manager 5.7.0 isolate_manager: ^5.7.0 copied to clipboard
Create multiple long-lived isolates for the Functions, supports Worker on the Web (with the effective generator) and WASM compilation.
5.7.0 #
- Able to compute a nullable function with a nullable parameter when using the
IsolateManagerShared
. - Improve the worker mappings generator.
- Basic Refactoring: Type Annotations, Final & Const Usage (thanks @Marc-R2).
- Add some PR notes.
5.6.1 #
- Improve the generator to generate the worker mappings better.
- Improve the
jsify
to convert theMap
better. - Improve the github workflows to ensure backward compatibility with the compiled Workers.
5.6.0 #
- Correctly parse the dart native arguments (Fixes #36).
- [Experiment] Automatically generate the
workerMappings
by adding the--worker-mappings-experiment=lib/main.dart
flag to the generator. - The code coverage is now using
dart test
instead offlutter test
so we can correctly test the code on bothvm
andchrome
. - Improve the performaces by improving the way to detect the
IsolateState
. - Improve tests.
5.5.2 #
- Improve Type cast in the
_IsolateManagerWorkerController
.
5.5.1 #
- Change the type of the
Map
fromString
todynamic
when converting bydartify
. - Add more tests for the Map.
5.5.0 #
- Able to create a
Map
function and use it as aWorker
instead of using JSON.
5.4.0 #
- Set the max number of the queued computations.
- Control how a new computation is added and retrieved from the Queue.
- Compute a priority computation (promote a computation to the top of the Queue so it will be compute as soon as possible).
5.3.0 #
- Able to add options and flags directly into to Dart to Js Compiler.
- Able to print the debug logs for the dart to js compiler (only if the
--debug
flag is specified).
5.2.1+3 #
- Improve README.
5.2.1+1 #
- Improve README.
5.2.1 #
- Update the package
web
version to support a wider range (">=0.5.1 <2.0.0").
5.2.0 #
- Bump the
web
to v1.0.0. - Update
README
.
5.1.0 #
- Stable now.
5.1.0-rc.1 #
- Improve README.
5.1.0-rc #
-
Add
IsolateManagerShared
to be able to compute the multiple Functions. -
Generate the shared Workers by using the
@isolateManagerSharedWorker
annotation. -
Able to generate a custom Worker from a
customFunction
by using the@isolateManagerCustomWorker
annotation. -
Improve the README.
-
Various improvements and optimizations.
-
The generator:
- The default
dart run isolate_manager:generate
command will generates both single and shared Workers. - Use
dart run isolate_manager:generate --single
to generate only the single functions (@isolateManagerWorker
and@isolateManagerCustomWorker
annotations). - Use
dart run isolate_manager:generate_shared --shared
to generate only the shared functions (@isolateManagerSharedWorker
annotation).
- The default
-
This is an
rc
version because the various improvements may affect some edge cases so I want to make sure it's fully backward-compatible
5.0.5+1 #
- Improve README.
5.0.5 #
- Avoid using static function for the log printer.
5.0.4 #
- Update the log printer to increase the performances.
- Update benchmark.
5.0.3 #
- Improve pub score.
5.0.2+1 #
- Update some comments and fix some TYPO.
- Rename from
benchmarks
tobenchmark
.
5.0.2 #
- Change the default generated js to level
O4
(Default level when usingflutter build web
). - Remove try catch to avoid unknown issues.
- Add more test cases and improve tests.
- Update the Worker base code.
- Update missed types.
- Update README.
5.0.1+1 #
- Re-organize the README.
- Update the description.
5.0.1 #
- Add
--omit-implicit-checks
flag when compiling tojs
to avoid type check issues. - Add comments to the
IsolateException
. - Update README.
5.0.0 #
- Bump sdk to
^3.3.0
. - Add a generator to generate the Web Worker by adding the
IsolateManagerWorker
andisolateManagerWorker
annotations (See more in README). - Implement the
call
method to theIsolateManager
. - Improve the
IsolateManager.create
behavior (use a new custom function). - Improve the type of the
customFunction
andworkerFunction
. - Remove
autoInitialize
parameter. - Remove deprecated methods.
- Bring the
isolate_contactor
to this package to make it lighter and easier to maintain. - BREAKING CHANGE: All isolate functions MUST be updated and all Workers MUST be recompiled. See the migration guide at the bottom of the README or at the changelog of the version
5.0.0-rc.1
.
5.0.0-rc.11 #
- Implement the
call
method. - Able to generate to WASM with
--wasm
flag (But unusable right now).
5.0.0-rc.10 #
- Fix issue with null
initialParams
increateCustom
. - Remove unused variable
autoMarkAsInitialized
and related code in thebase
. - Update tests.
5.0.0-rc.9 #
- Able to generate static functions (Classs.function => Class.function.js).
- Improve the generator (only generate the needed files to reduce time).
- Improve the generated logs.
5.0.0-rc.8 #
- Add a generator to generate the Worker JS by adding the
IsolateManagerWorker
andisolateManagerWorker
annotations. - Update README.
5.0.0-rc.7 #
- Update to improve the score.
5.0.0-rc.6 #
- Update the CHANGELOG to show the migration guide.
5.0.0-rc.5 #
- Export the
IsolateState
. - Update the CHANGELOG to show the migration guide.
5.0.0-rc.4 #
- Bring the
isolate_contactor
to this package and make it lighter and easier to maintain. - Update the tests.
- Remove unneeded platforms in the example.
5.0.0-rc.3 #
- Remove deprecated methods.
- Improve the
IsolateManager.create
behavior (use a newcustomFunction
). - Improve the type of the
customFunction
andworkerFunction
.
5.0.0-rc.2 #
- Update README.
- Update homepage for beta version.
5.0.0-rc.1 #
- Bump sdk to
^3.3.0
. - Remove
autoInitialize
parameter. - Remove deprecated methods.
- MIGRATION: All isolate functions MUST be update and all Workers MUST be recompiled:
- If you're using the
IsolateManagerFunction.workerFunction
, you need to re-generate theJS
for the Web Worker (compile fromDart
toJS
). TheIsolateManagerFunction.customFunction
will be automatically applied. - If you're using the old method, you need to send a
initialized
signal from anIsolate
and aWorker
:-
Custom function of an
Isolate
: add thecontroller.initialized();
to the end of the function.-
Before:
void customFunction(dynamic params) { final controller = IsolateManagerController(params); controller.onIsolateMessage.then((value){ // ... }); }
-
After:
void customFunction(dynamic params) async { // Do something sync or async here final controller = IsolateManagerController(params); controller.onIsolateMessage.then((value){ // ... }); controller.initialized(); // <-- }
-
-
On the Web
Worker
: addjsSendMessage(IsolateState.initialized.toJson());
to the end of themain
method.-
Before:
void main() { callbackToStream('onmessage', (MessageEvent e) { return js_util.getProperty(e, 'data'); }).listen((message) { // ... }); }
-
After:
void main() async { // Do something sync or async here callbackToStream('onmessage', (MessageEvent e) { return js_util.getProperty(e, 'data'); }).listen((message) { // ... }); jsSendMessage(IsolateState.initialized.toJson()); // <-- }
-
-
- If you're using the
4.3.1 #
- Export the
IsolateState
.
4.3.0 #
- Support
WASM
. - Add benchmark tests.
- Deprecate the
IsolateFunctionHelper
in favor of theIsolateManagerFunction
. - Improve the
IsolateManagerFunction.workerFunction
. - [Experiment and Optional] Able to send an
initialized
signal from the isolate to the main app to ensure that the isolate is ready to receive the messages from the main app. The Migration Steps:- Step 1:
-
If you're using the
IsolateManagerFunction.workerFunction
, you need to re-generate theJS
for the Web Worker (compile fromDart
toJS
). TheIsolateManagerFunction.customFunction
will be automatically applied. -
If you're using the old method, you need to send a
initialized
signal from anIsolate
and aWorker
:-
Custom function of an
Isolate
: add thecontroller.initialized();
to the end of the function.-
Before:
void customFunction(dynamic params) { final controller = IsolateManagerController(params); controller.onIsolateMessage.then((value){ // ... }); }
-
After:
void customFunction(dynamic params) async { // Do something sync or async here final controller = IsolateManagerController(params); controller.onIsolateMessage.then((value){ // ... }); controller.initialized(); // <-- }
-
-
On the Web
Worker
: addjsSendMessage(IsolateState.initialized.toJson());
to the end of themain
method.-
Before:
void main() { callbackToStream('onmessage', (MessageEvent e) { return js_util.getProperty(e, 'data'); }).listen((message) { // ... }); }
-
After:
void main() async { // Do something sync or async here callbackToStream('onmessage', (MessageEvent e) { return js_util.getProperty(e, 'data'); }).listen((message) { // ... }); jsSendMessage(IsolateState.initialized.toJson()); // <-- }
-
-
-
Step 2: Update the
create
andcreateCustom
method:- Before:
final isolate = await IsolateManager.create( function, workerName: 'function', );
- After:
final isolate = await IsolateManager.create( function, workerName: 'function', autoInitialize: false, // <-- );
-
- Step 1:
4.2.2 #
- Bump
isolate_contacter
tov4.1.0
. - Add a class
IsolateFunctionHelper
containscustomFunction
andworkerFunction
. - Deprecate the
createOwnIsolate
in favor of thecreateCustom
. - Deprecate the
isolateWorker
in favor of theIsolateFunctionHelper.workerFunction
. - Improve README.
4.2.1+1 #
- Fixed the issue that causes the
sendMessage
to be unable to throw theException
when thecallback
is set. - Easier to create a Worker by using
isolateWorker
method (Detail in README). - Remove unused methods of the
IsolateManagerController
. - Improve README.
- Improve tests.
- Improve the code coverage.
4.1.5+1 #
- Improved README.
4.1.5 #
- Add
fetchAndDecode
example. - Update README to
fetchAndDecode
.
4.1.4 #
- Add more complex examples (also for
Worker
).
4.1.3 #
- Add example for
Worker
. - Update README.
4.1.2 #
- Update homepage URL.
4.1.1 #
- Add
queuesLength
to get the number of the current queuing elements. - Add
ensureStarted
to able to wait for thestart
method to finish when you want to call thestart
method manually withoutawait
and wait for it later. - Add
isStarted
to check if thestart
method is completed or not.
4.1.0 #
- Add
callback
parameter tocompute
method to fully control the final result (Useful when you need to send something like the progress value before sending the final result in the samecompute
). - Mark
isolateManager.onMessage
as deprecated. - Add example that uses
callback
parameter to build a progress bar before getting the final result.
4.0.0 #
- Add
sendResultError
toIsolateManagerController
to make it easier to send the Exception from the Isolate to main app. IsolateException
parameters are nowObject
andStackTrace
.- Add parameter type as
P
and change return type toR
. - Add return type as
void
toonDispose
method. - Change
isolateParams
from dynamic toObject?
. - Update tests.
- Update example.
3.0.1 #
- [Fixes]: The
compute
method will be failed if user tap on a button that calling it multiple times continuously. - Improves tests.
3.0.0 #
- Bumped Dart sdk to
>=2.18.0 <4.0.0
.
2.2.0+5 #
- Add
isolates_helper
to README.
2.2.0+4 #
- Improves README.
- Add
IsolateManager.debugLogPrefix
to set the prefix debug logs.
2.2.0+2 #
- Improve
worker.dart
imports. - Use new
worker.dart
in testing.
2.2.0+1 #
- Improve function descriptions.
- Improve README for catching exception with
createOwnIsolate
.
2.2.0 #
- Support
try-catch
block for all platforms including Worker on Web. - Update
worker.dart
to supporttry-catch
block. - Change all the debug logs prefix to
[Isolate Mangager]
. - Add test for
try-catch
. - Increase min SDK to 2.15.0.
2.1.2+1 #
- Improve pub scores.
2.1.2 #
-
The method
.start()
is now optional, the plugin will automatically call this method when using.compute
for the first time, so you have 3 way to create the instance:- Basic usage:
IsolateManager<int> isolateManager = IsolateManager.create( fibonacci, concurrent: 4, ); await isolateManager.start();
- Use
start
withoutawait
:
IsolateManager<int> isolateManager = IsolateManager.create( fibonacci, concurrent: 4, ); isolateManager.start();
- Use
start
when creating the instance:
IsolateManager<int> isolateManager = IsolateManager.create( fibonacci, concurrent: 4, )..start();
2.1.1 #
- On Flutter >3.3.0 -
@pragma('vm:entry-point')
annotation must be added to all methods that you want to use for isolation. Read README for more information.
2.1.0 #
- [BREADKING CHANGE]: Change the parameter name from
numOfIsolates
toconcurrent
. - Update dependencies.
2.0.2+3 #
- Improve README.
2.0.2+2 #
- Changes the name from
function_name
toworker
. - Improves
worker.dart
form. - Improves README.
2.0.2 #
- Fixes issue in
restart
andstop
methods.
2.0.1+3 #
- Improve function headers.
2.0.1+2 #
- Update function headers.
- Update README.
- Update dependencies.
2.0.1+1 #
- Update base
function_name.dart
to make it works withFutureOr
function. - Add
function_name.js
to example and create example for it.
2.0.1 #
- Remove useless
await
in README. - Downgrade Dart SDK min version to
2.12.0
.
2.0.0 #
- NO BREAKING CHANGE
- Add
Worker
for Web platform (real Isolate on Web). Read README for more details.
1.0.0+1 #
- Update README
1.0.0 #
- BREAKING CHANGE: Change
isolateFunction
parameter ofcreateOwnIsolate
method from named to required parameter. - Added
initialParams
parameter tocreateOwnIsolate
method. - Added
initialParams
getter toIsolateManagerController
. - Bring to stable version.
0.1.0 #
- Update example
0.0.1 #
- Initial release