processQrForResult method
Processes a QR code and returns the parsed EMV transaction data.
The QR code should be in a format compatible with the EMV parsing logic implemented in the native layer. This method sends the QR code string to the Android native code, which parses it and returns a map of EMV fields. These are then converted into an EmvQrData object.
qrData The base64-encoded TLV QR code string to be parsed.
Returns an EmvQrData object containing the transaction details,
or null if an error occurred or parsing failed.
Implementation
Future<EmvQrData?> processQrForResult(String qrData) async {
try {
final Map<dynamic, dynamic> result = await _channel.invokeMethod(
'processQrForResult',
{'qrData': qrData},
);
return result.isNotEmpty ? EmvQrData.fromMap(result) : null;
} on PlatformException catch (e) {
debugPrint('Error processing QR for result: ${e.message}');
return null;
}
}