startImageStream method

Future<void> startImageStream({
  1. required void onImageStream(
    1. CameraImage image
    ),
})

Implementation

Future<void> startImageStream({required void Function(CameraImage image) onImageStream}) async {
  if (cameraController == null) {
    log("unable to startImageStream, cameraController missing");
    return;
  }
  cameraController?.startImageStream((image) {
    if (timer != null) return;
    timer = Timer(const Duration(seconds: 2), () {
      onImageStream(image);
      timer?.cancel();
      timer = null;
    });
  });
}