normalize method

  1. @override
String normalize(
  1. String data
)
override

Returns the barcode string with the correct checksum

Implementation

@override
String normalize(String data) {
  if (fixedLength != null) {
    return checkLength(
        zeroPrepend
            ? data.padRight(minLength, '0').substring(0, minLength)
            : data,
        maxLength);
  }

  if (zeroPrepend && ((data.length % 2 != 0) != addChecksum)) {
    data = '0$data';
  }

  if (addChecksum) {
    data += checkSumModulo10(data);
  }

  return data;
}