normalize method
Returns the barcode string with the correct checksum
Implementation
@override
String normalize(String data) {
if (data.length <= 8) {
// Try to convert UPC-E to UPC-A
data = upceToUpca(data.padRight(6, '0'));
}
data = checkLength(data, maxLength);
final first = data.substring(0, 1);
final last = data.substring(11, 12);
try {
data = upcaToUpce(data);
} on BarcodeException {
if (fallback) {
return data;
}
rethrow;
}
return '$first$data$last';
}