transform_in_isolate 0.1.1 transform_in_isolate: ^0.1.1 copied to clipboard
Run stream transfor in isolate. Spawns new isolate when bind() method is called on isolate. Instance of transformer is then sent to isolate. Initial state within transformer as well as stream messages [...]
transform_in_isolate #
Run stream transformer in isolate.
New isolate is spawned when stream.transform()
is called, and closes when either input stream completes or output subscription is cancelled.
API:
TransformInIsolate(StreamTransformer<S, T>) -> StreamTransformer<S, T>
Example:
Stream.fromIterable([1, 2, 3])
.transform(TransformInIsolate(MyTransform()))
.listen(print);
class MyTransform extends StreamTransformerBase {
bind(s) => s.map((val) => val * 2) // this code will run in isolate
}