computer 2.0.0
computer: ^2.0.0 copied to clipboard

Easy to use pool of concurrent workers with compute() like API.

Computer #

Computer is a lightweight library for concurrent computations, which provides Flutter's compute like API.

Features #

  • Easy to use API
  • No overhead on creating & releasing isolates for each task. Workers initialized on start and ready to solve your tasks
  • Strictly defined number of workers

Note #

Computer is a singleton

How to use #

Computer provides just 3 methods

turnOn() #

Before using the Computer you need to turnOn it. This will create workers and initialize them. Then you may use compute() method.

final computer = Computer();

await computer.turnOn(
  workersCount: 4, // optional, default 2
  verbose: false, // optional, default false
);

compute() #

compute will execute your function inside one of the workers. Function may be async. The callback argument must be a top-level or static method of a class.

final result = await computer.compute(
  fib,
  param: 45, // optional
);

turnOff() #

If you don't need workers anymore, you can turnOff the Computer. It will destroy workers.

await computer.turnOff();
27
likes
120
pub points
75%
popularity

Easy to use pool of concurrent workers with compute() like API.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

nineonedev@gmail.com

License

MIT (LICENSE)

Dependencies

meta

More

Packages that depend on computer