lot_expiry_parser 0.1.0
lot_expiry_parser: ^0.1.0 copied to clipboard
Reads the batch (lot) number and the expiry date from OCR text of product packs: LOT/EXP labels, ISO symbol columns, one-letter labels and unlabelled codes.
import 'package:lot_expiry_parser/lot_expiry_parser.dart';
void main() {
// Text lines as an OCR engine returned them, in reading order.
final packs = <List<String>>[
['LOT AB123', 'EXP 2027-05'],
['B.N PM6111', r'MFG 04 \ 25', r'EXP 03 \ 27'],
['LOT', 'MFG', '1166/25', '10/2025', '09/2030'],
['B 144692609U', 'P 09/26 E 09/29'],
['C210Y50002', 'M 11/25', 'E 11/28'],
];
for (final lines in packs) {
final result = LotExpiryParser.parse(lines);
print('$lines -> batch: ${result.batch}, expiry: ${result.expiry}');
}
}