Menu

1 / 5

barcode_gen: 1D barcodes for Flutter that snap to whole pixels and export to SVG

DEV Community: mobile·Abdeldjalil Chougui·9 days ago
#q9pdrybh
#devtomobile#devto#dev#code#module
Long article (1462 words) — no AI summary yet.
Reading 0:00
15s threshold

A barcode on a screen or a printed label has one job: a scanner must read it the first time. Two things usually get in the way. The first is the encoding itself: check digits, guard bars, code-set switching in Code 128, and the FNC1 separators of GS1-128 all have exact rules. The second is rendering. A barcode is a sequence of bars whose widths are multiples of one unit, the module. If a module is 1.7 pixels wide, some bars are drawn with blurry grey edges, and their widths are no longer exact multiples of each other.

barcode_gen is a 1D barcode generator for Dart and Flutter built around those two points. The encoders are pure Dart and have module-exact tests. The widget snaps every module to whole device pixels, and you can export to SVG or PNG.

What it does

EAN-13, EAN-8, UPC-A and UPC-E (ISO/IEC 15420). Check digits are computed or verified. UPC-E to UPC-A expansion and compression follow the four GS1 zero-suppression rules ( upcEToUpcA , upcAToUpcE ), and number systems 0 and 1 are both supported.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.