flutterdartbarcodegs1-datamatrix

Generate GS1 DataMatrix in Flutter


Simple example of BarcodeWidget from pub:barcode_widget

String code = "010460437111281215A&r2L93P2t1"
return pw.BarcodeWidget(
      margin: pw.EdgeInsets.all(24),
      drawText: false,
      barcode: Barcode.dataMatrix(),
      data: code);

As a result I get DataMatrix, not GS1 DataMatrix because the FNC1 symbol is missing at the beginning of the code.

I tried adding FNC1 to the beginning of the code like {FNC1}, < FNC1 >, è (etc ASCII 0232).

Hint of dataMatrix() func is

Use [DataMatrixEncoder] to generate GS1 codes

I tried add fnc1 by [DataMatrixEncoder], but nothing works.

Please, help me to create GS1 DataMatrix barcode and show it on the screen.


Solution

  • So, another library is worked. package:zxing_widget/

    BarcodeWidget(
                DataMatrixPainter(
                  compact: true,
                  gs1Format: true,
                  '0104111123005281215A&r293P2t1',
                  foregroundColor: Colors.blue,
                ),
                size: Size(200, 200),
              ),
    

    But without < compact: true > it not worked. If true, GS1 Datamatrix well done.