decodePdf method
Future<List<PdfBarcode> >
decodePdf({
- String? filePath,
- Uint8List? pdfBytes,
- required DecoderConfig config,
override
Platform interface method to decode barcodes from either filePath or pdfBytes.
Implementation
@override
Future<List<PdfBarcode>> decodePdf({
String? filePath,
Uint8List? pdfBytes,
required DecoderConfig config,
}) async {
try {
final List<dynamic>? results = await methodChannel
.invokeListMethod<dynamic>('decodePdf', {
'filePath': filePath,
'pdfBytes': pdfBytes,
'config': config.toMap(),
});
if (results == null) return [];
return results
.map((e) => PdfBarcode.fromMap(e as Map<Object?, Object?>))
.toList();
} on PlatformException catch (e) {
throw PdfBarcodeException(
code: e.code,
message: e.message ?? 'Unknown error',
details: e.details,
);
}
}