convert method

  1. @override
Iterable<bool> convert(
  1. String data
)
override

Actual barcode computation method, returns a stream of bool which represents the presence or absence of a bar

Implementation

@override
Iterable<bool> convert(String data) sync* {
  yield* add(BarcodeMaps.code39StartStop, BarcodeMaps.code39Len);

  for (var code in data.codeUnits) {
    final codeValue = BarcodeMaps.code39[code];
    if (codeValue == null) {
      throw BarcodeException(
          'Unable to encode "${String.fromCharCode(code)}" to $name Barcode');
    }
    yield* add(codeValue, BarcodeMaps.code39Len);
  }

  yield* add(BarcodeMaps.code39StartStop, BarcodeMaps.code39Len);
}