Skip to content
pubscout

barcode

2.2.9, released 2 years ago by nfet.net

Barcode generation library for Dart that can generate generic drawing operations for any backend.

WASM-ready
$ flutter pub add barcode
Source repository

What it does

Generates generic drawing operations and formats (like SVG) for 1D and 2D barcodes including QR codes, Data Matrix, PDF417, and various product codes. It relies purely on Dart with no platform-dependent implementation, acting as a base library for generating barcodes across different outputs.

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

Use it when

  • You need to generate barcodes in pure Dart or backend environments.
  • You want to produce SVG, PDF, or custom drawn barcodes.

Skip it when

  • You need to scan or read barcodes from a camera rather than generate them.
  • You are looking for a pre-built Flutter widget directly out of the box (use barcode_widget instead).

Strengths

  • Supports a wide variety of 1D, 2D, and height-modulated barcodes.
  • Platform-agnostic with no platform-dependent implementation.
  • Can output generic drawing operations and SVGs.

Weaknesses

  • Does not include camera scanning capabilities.
  • Requires helper libraries or packages like barcode_widget or pdf for high-level rendering in Flutter or PDF apps.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2
final dm = Barcode.dataMatrix();
final svg = dm.toSvg('Hello World!', width: 200, height: 200);
await File('barcode.svg').writeAsString(svg);

Alternatives

Packages that do the same job and could replace barcode.

Works with

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