barcode
Barcode generation library for Dart that can generate generic drawing operations for any backend.
- If you are looking to print barcodes, use pub:pdf.
- If you want to display barcodes in a Flutter application, use pub:barcode_widget.
- To generate SVG barcodes see the example tab.
- To generate barcodes in images, use pub:barcode_image.
- Live example with Flutter Web: https://davbfr.github.io/dart_barcode/
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:
- Filled rectangle to draw the bars
- Text drawing to display the code in full-text
Generate barcodes
// 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);
Supported barcodes
The following barcode images are SVG. The proper rendering, especially text, depends on the browser implementation and availability of the fonts.
1D Barcodes
Code 39
Code 93
Code 128 A
Code 128 B
Code 128 C
GS1-128
Interleaved 2 of 5 (ITF)
ITF-14
EAN 13
EAN 8
EAN 2
EAN 5
ISBN
UPC-A
UPC-E
Telepen
Codabar
Height Modulated Barcodes
RM4SCC
2D Barcodes
QR-Code
PDF417
Data Matrix
Aztec
Download Barcode generation library source code on GitHub
https://github.com/DavBfr/dart_barcode
Check out the details & implementation guide on PUB
https://pub.dev/packages/barcode
Provides the list of the opensource Flutter apps collection with GitHub repository.