parseTicket method

Future<Uint8List?> parseTicket()

parses a ticket

  • decodes the byte list into an image
  • optimizes the size to focus on the Aztec (best guess)
  • binary encodes into high/low brightness
  • applies the Aztec reader
  • returns the String extracted from the Aztec reader

Implementation

Future<Uint8List?> parseTicket() async {
  final ticketPicture = this.ticketPicture;
  if (ticketPicture == null) return null;

  final decoded = decodeImage(ticketPicture);
  if (decoded == null) return null;

  final square = _cropCenterAztec(decoded);

  final decoder = customAztecDecoder ?? defaultAztecReader;

  return await decoder.call(square);
}