detectBarcodeContinuously method

  1. @override
Stream<Barcode?> detectBarcodeContinuously()
override

Starts scanning QR codes or barcodes

Implementation

@override
Stream<Barcode?> detectBarcodeContinuously() {
  final controller = StreamController<Barcode?>();
  controller.onListen = () async {
    _reader?.decodeContinuously(
      video,
      allowInterop((result, error) {
        if (result != null) {
          controller.add(result.toBarcode());
        }
      }),
    );
  };
  controller.onCancel = () {
    _reader?.stopContinuousDecode();
  };
  return controller.stream;
}