Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waitForCardPresent throws error #6

Open
nhim175 opened this issue Jan 2, 2023 · 3 comments
Open

waitForCardPresent throws error #6

nhim175 opened this issue Jan 2, 2023 · 3 comments

Comments

@nhim175
Copy link

nhim175 commented Jan 2, 2023

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

  1. Connect to a card reader
  2. 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>
@milkyway044
Copy link

milkyway044 commented Feb 27, 2023

the same:
ACS ACR1281 1S Dual Reader
macOS 12.6.2
flutter 3.7.5
Снимок экрана 2023-02-27 в 16 25 58

@milkyway044
Copy link

missing one line on two platforms: macos and windows
after adding everything works as expected!

dexter69 added a commit to dexter69/flutter_pcsc that referenced this issue Apr 15, 2023
As mentioned here
fabienrousseau#6 (comment)
Thanks milkyway
@dompagoj
Copy link

dompagoj commented Dec 2, 2024

Hi, im still getting this error on MacOS, any help would be appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants