parse method

  1. @override
ISBNParsedResult? parse(
  1. Result result
)
override

Implementation

@override
ISBNParsedResult? parse(Result result) {
  final format = result.barcodeFormat;
  if (format != BarcodeFormat.ean13) {
    return null;
  }
  final rawText = ResultParser.getMassagedText(result);
  final length = rawText.length;
  if (length != 13) {
    return null;
  }
  if (!rawText.startsWith('978') && !rawText.startsWith('979')) {
    return null;
  }

  return ISBNParsedResult(rawText);
}