aisolatepool 1.0.2 copy "aisolatepool: ^1.0.2" to clipboard
aisolatepool: ^1.0.2 copied to clipboard

discontinued

a isolate util, help developers use Isolate more friendly under the flutter framework to activate the multi-core performance of the device.

isolate pool #

Help developers use Isolate more friendly under the flutter framework to activate the multi-core performance of the device.

Getting Started #

example: #

//define a top-level function
bool testIsolateRun(Object any) {
  IsolatePool.logger(LOG_LEVEL.INFO, "testIsolateRun", "working on thread ${Isolate.current.toString()}, param:$any");
  return true;
}

//Run testIsolateRun in the isolated thread pool
IsolatePool.io.run(testIsolateRun, "params for testIsolateRun");
//Run testIsolateRun in the isolated thread pool with custom params
IsolatePool.io.run(testIsolateRun, _AnyParam(true, 200, 200.0,"stringParam"))
        .catchError((error){
        //catch exception from isolate thread
});


class _AnyParam {
  final bool boolParam;
  final int intParam;
  final double doubleParam;
  final String stringParam;

  _AnyParam(this.boolParam, this.intParam, this.doubleParam, this.stringParam);

  @override
  String toString() {
    return "bool:$boolParam, int:$intParam, double:$doubleParam, string:$stringParam";
  }
}

0
likes
30
pub points
0%
popularity

Publisher

verified publisheradeveloper.tech

a isolate util, help developers use Isolate more friendly under the flutter framework to activate the multi-core performance of the device.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

dio, flutter, stack_trace

More

Packages that depend on aisolatepool