Skip to content
pubscout

barcode_scan2

4.9.0, released 9 days ago by mono0926.com

A flutter plugin for scanning 2D barcodes and QRCodes via camera.

Rock solid
$ flutter pub add barcode_scan2
Source repository

What it does

A Flutter plugin that provides a simple wrapper around iOS and Android libraries to scan 2D barcodes and QR codes. It handles camera permissions and provides options to control flash and restrict barcode formats.

AI-written summary of version 4.8.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need a straightforward, modal-based barcode and QR code scanner.
  • You need to quickly capture barcode string data with minimal UI customization.

Skip it when

  • You need an embedded widget preview inside your own custom UI rather than a full-screen scanner view.
  • You want a pure Dart implementation without native library wrappers.

Strengths

  • Simple API with a single `BarcodeScanner.scan()` method call.
  • Built-in permission handling and flash control options.

Weaknesses

  • Relies on older underlying native libraries (MTBBarcodeScanner and barcodescanner).
  • Limited to full-screen scanning flows rather than embedded widget views.

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
1

Requires adding CAMERA permission to AndroidManifest.xml and NSCameraUsageDescription to Info.plist on iOS. Android requires Kotlin configuration.

import 'package:barcode_scan2/barcode_scan2.dart';

void main() async {
  var result = await BarcodeScanner.scan();

  print(result.type);
  print(result.rawContent);
  print(result.format);
}

Alternatives

Packages that do the same job and could replace barcode_scan2.

Works with

Packages commonly used together with barcode_scan2: ones it builds on, ones built on it, and its own family.