pub package

English, 日本語

camera_worker is a library that converts streaming images from a camera to luminance information for easy processing, and supports parallel processing by Isolate.

Getting started

Prepare a function to process the brightness information of each frame.
It should be a top class function or a static method because it will be processed by Isolate so that it can handle heavy processing such as image recognition.
The return value type is free.

String _workerMethod(Luminances lumi) {
  /// Do image processing, etc.
  return 'abc';

Create a WorkerController with the methods prepared above.

final controller = WorkerController<String>(_workerMethod);

Initialize and destroy the WorkerController with init/dispose.

void initState() {
  controller.init().then((_) {

void dispose() {

Streaming will be started with start. The value received will be the return value of the method specified when creating the WorkerController. If maxWidth is specified, the image will be scaled down while maintaining the aspect ratio.

final stream = await controller.start(maxWidth: 800);
stream.listen((e) {