flutter_barcode_sdk 4.1.0 copy "flutter_barcode_sdk: ^4.1.0" to clipboard
flutter_barcode_sdk: ^4.1.0 copied to clipboard

The only Flutter barcode SDK for Android, iOS, Web, Windows, Linux, macOS. Empower developers to build 1D/2D barcode reader and barcode scanner.

flutter_barcode_sdk #

pub package GitHub license

A cross-platform Flutter plugin for barcode reading and scanning, powered by the Dynamsoft Barcode Reader SDK. Supports Android, iOS, Web, Windows, and Linux.

Decode a wide range of 1D and 2D barcode symbologies from image files and raw pixel buffers. Build robust barcode reader and scanner applications with minimal effort.

Tip: For production-grade live camera scanning, consider using the official Dynamsoft Capture Vision Flutter Edition which offers optimized real-time performance.

Table of Contents #

Getting Started #

1. Install the Package #

dependencies:
  flutter_barcode_sdk: ^4.1.0

2. Obtain a License Key #

A valid license is required to activate barcode decoding functionality.

Get Trial License

3. Initialize the SDK #

import 'package:flutter_barcode_sdk/flutter_barcode_sdk.dart';
import 'package:flutter_barcode_sdk/dynamsoft_barcode.dart';

final barcodeReader = FlutterBarcodeSdk();
await barcodeReader.setLicense('YOUR-LICENSE-KEY');
await barcodeReader.init();

Supported Platforms #

Platform Status
Android Supported
iOS Supported
Web Supported
Windows Supported
Linux Supported

Supported Barcode Symbologies #

Linear Barcodes (1D) #

Code 39 (including Extended) | Code 93 | Code 128 | Code 11 | Code 32 | Codabar | Interleaved 2 of 5 | Industrial 2 of 5 | Matrix 2 of 5 | EAN-8 | EAN-13 | UPC-A | UPC-E | MSI Code | Telepen | Telepen Numeric

2D Barcodes #

QR Code (including Micro QR) | Data Matrix | PDF417 (including Micro PDF417) | Aztec Code | MaxiCode (modes 2-5) | DotCode

GS1 DataBar #

Omnidirectional | Truncated | Stacked | Stacked Omnidirectional | Expanded | Expanded Stacked | Limited

Postal Codes #

USPS Intelligent Mail | Postnet | Planet | Australian Post | Royal Mail (RM4SCC) | KIX

Other #

Patch Code | GS1 Composite Code | Pharmacode (One-Track / Two-Track) | Non-standard Barcode

Platform Configuration #

Android #

Set the minimum SDK version in android/app/build.gradle:

minSdkVersion 21

iOS #

Add camera usage descriptions to ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>Camera access is required for barcode scanning.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required by the camera plugin.</string>

Windows and Linux #

Ensure CMake and a platform-specific C++ compiler are installed.

Web #

Include the Dynamsoft JavaScript SDK in web/index.html:

<script src="https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@11.2.4000/dist/dbr.bundle.js"></script>

Usage #

Decode from an Image File #

List<BarcodeResult> results = await barcodeReader.decodeFile('path/to/image.png');

for (var result in results) {
  print('${result.format}: ${result.text}');
}

Decode from a Camera Buffer #

List<BarcodeResult> results = await barcodeReader.decodeImageBuffer(
  bytes,      // Uint8List - raw pixel data
  width,      // Image width
  height,     // Image height
  stride,     // Bytes per row
  format,     // Pixel format index (e.g., ImagePixelFormat.IPF_NV21.index)
  rotation,   // 0, 90, 180, or 270
);

Set Barcode Formats #

await barcodeReader.setBarcodeFormats(
  BarcodeFormat.QR_CODE | BarcodeFormat.CODE_128 | BarcodeFormat.EAN_13,
);

Configure Advanced Parameters #

String params = await barcodeReader.getParameters();
// Modify the JSON string as needed...
await barcodeReader.setParameters(params);

API Reference #

Method Description Return
setLicense(String license) Activates the SDK with a license key. Future<int>
init() Initializes the barcode reader with default parameters. Future<int>
decodeFile(String filename) Decodes barcodes from an image file. Future<List<BarcodeResult>>
decodeImageBuffer(...) Decodes barcodes from raw pixel data (camera preview, etc.). Future<List<BarcodeResult>>
setBarcodeFormats(int formats) Sets which barcode formats to detect. Future<int>
getParameters() Returns the current detection settings as JSON. Future<String>
setParameters(String params) Updates detection settings from a JSON string. Future<int>

See BarcodeFormat for all available format constants and ImagePixelFormat for supported pixel formats.

Examples #

Mobile (Android / iOS) #

cd example
flutter run
Barcode Scanner Barcode Reader
Scanner Reader

Desktop (Windows / Linux) #

cd example
flutter run -d windows   # or -d linux

Web #

cd example
flutter run -d chrome

Web Scanner

149
likes
150
points
1.45k
downloads

Publisher

verified publisheryushulx.me

Weekly Downloads

The only Flutter barcode SDK for Android, iOS, Web, Windows, Linux, macOS. Empower developers to build 1D/2D barcode reader and barcode scanner.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on flutter_barcode_sdk

Packages that implement flutter_barcode_sdk