detectBarcodeContinuously method

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

Starts scanning QR codes or barcodes

Implementation

@override
Stream<Barcode?> detectBarcodeContinuously() async* {
  yield* Stream.periodic(frameInterval, (_) {
    return _captureFrame(video);
  }).asyncMap((event) async {
    final code = await event;
    if (code == null) {
      return null;
    }
    return Barcode(
      rawValue: code.data,
      rawBytes: Uint8List.fromList(code.binaryData),
      format: BarcodeFormat.qrCode,
    );
  });
}