toPattern method

  1. @override
List<bool> toPattern()
override

Implementation

@override
List<bool> toPattern() {
  final head = rawValue[0];
  final body = rawValue.substring(1);
  final leftBlockSymbols = leftParitySpecification[head]!
      .asMap()
      .entries
      .map((e) => e.value(body[e.key]))
      .toList();

  final rightBlockSymbols = List<BarcodeSymbol>.generate(
          6, (index) => RightParityModule(value: body.substring(6)[index]))
      .toList();
  final numberSymbolsOrigin = <BarcodeSymbol>[
    LeftMargin(),
    LeftGuardSymbol(),
    ...leftBlockSymbols,
    CenterGuardSymbol(),
    ...rightBlockSymbols,
    RightGuardSymbol(),
    RightMargin(),
  ];
  return numberSymbolsOrigin.expand((e) => e.toPattern()).toList();
}