I found some issue with waitForCardPresent on Mac so I open this ticket.
Issue
waitForCardPresent method throws an error: type 'Null' is not a subtype of type 'int'
Steps to reproduce
Connect to a card reader
Execute the below code (bind to a click handler or something). Most of the code is copied from the example, except for the use of waitForCardPresent
readCard() async {
int ctx = await Pcsc.establishContext(PcscSCope.user);
print('Context: $ctx');
List<String> readers = await Pcsc.listReaders(ctx);
if (readers.isEmpty) {
print('Could not detect any reader');
} else {
String reader = readers[0];
print('Using reader: $reader');
await Pcsc.waitForCardPresent(ctx, reader); // <-------- This line throw error
CardStruct card = await Pcsc.cardConnect(
ctx, reader, PcscShare.shared, PcscProtocol.any);
var response = await Pcsc.transmit(card, [0xFF, 0xCA, 0x00, 0x00, 0x00]);
print('Response: ${hexDump(response)}');
await Pcsc.cardDisconnect(card.hCard, PcscDisposition.resetCard);
}
await Pcsc.releaseContext(ctx);
}
What's the expected result?
No errors should be thrown
What's the actual result?
Error is thrown when the function runs
Additional details / screenshot
OS: Mac Ventura
Device: SONY FeliCa RC-S300/P
Error message:
flutter: Context: 2
flutter: Using reader: SONY FeliCa RC-S300/P
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'int'
#0 PCSCBinding.waitForCardPresent (package:flutter_pcsc_macos/src/pcsc_bindings.dart:149:9)
<asynchronous suspension>
#1 BootScreen.readCard (package:uniform_client_app_flutter/screens/boot.dart:37:7)
<asynchronous suspension>
I found some issue with
waitForCardPresent
on Mac so I open this ticket.Issue
waitForCardPresent
method throws an error:type 'Null' is not a subtype of type 'int'
Steps to reproduce
Execute the below code (bind to a click handler or something). Most of the code is copied from the example, except for the use of
waitForCardPresent
What's the expected result?
What's the actual result?
Additional details / screenshot
Error message: