Random Barcode Detections on Timeout When No QR Code Is Present (mobile_scanner)
01:35 03 Nov 2025

I’m getting random barcode values when the scanner view closes due to timeout even though no QR code or barcode in front of the camera.

Each time this happens, the detected values are different.

Code :

MobileScanner(
  fit: BoxFit.contain,
  errorBuilder: (context, error, child) => const SizedBox(),
  controller: _cameraController,
  onDetect: (capture) async {
    log("${capture.barcodes.first.rawValue} first value");

    for (final val in capture.barcodes) {
      log(val.rawValue ?? "raw value from list");
    }

    log("${capture.raw} Raw value");
  },
),

Output :

[log] 7181710678871first value
[log] 7181710678871
[log] {name: barcode, data: [{calendarEvent: null, contactInfo: null, corners: [{x: 608.0, y: 1363.0}, {x: 611.0, y: 1369.0}, {x: 299.0, y: 1468.0}, {x: 297.0, y: 1462.0}], displayValue: 7181710678871, driverLicense: null, email: null, format: 32, geoPoint: null, phone: null, rawBytes: [55, 49, 56, 49, 55, 49, 48, 54, 55, 56, 56, 55, 49], rawValue: 7181710678871, size: {width: 314.0, height: 105.0}, sms: null, type: 5, url: null, wifi: null}], image: {bytes: null, width: 1440.0, height: 1920.0}}  Raw value

version : mobile_scanner: ^7.1.3

flutter flutter-dependencies qr-code flutter-qrcode