Published 2026-08-29
copied due to outdated dependencies.
@ruud
Updated dependencies and updated analysis options. Fixed code.
Barcode generation library for Dart that can generate generic drawing operations for any backend.
They all use this library to generate the drawing operations.
Interactive demo: https://davbfr.github.io/dart_barcode/
This library is the base to create flutter widgets or pdf barcodes. It depends only on dart with no platform-dependent implementation.
Only two basic drawing primitives are required:
// Create a DataMatrix barcode
final dm = Barcode.dataMatrix();
// Generate a SVG with "Hello World!"
final svg = bc.toSvg('Hello World!', width: 200, height: 200);
// Save the image
await File('barcode.svg').writeAsString(svg);
Create a WIFI configuration barcode:
// Create a DataMatrix barcode
final dm = Barcode.dataMatrix();
final me = MeCard.wifi(
ssid: 'Wifi Name',
password: 'password',
);
// Generate a SVG with a barcode that configures the wifi access
final svg = bc.toSvg(me.toString(), width: 200, height: 200);
// Save the image
await File('wifi.svg').writeAsString(svg);
The following barcode images are SVG. The proper rendering, especially text, depends on the browser implementation and availability of the fonts.