regulaforensics / DocumentReader-Flutter

Flutter plugin for reading and validation of identification documents
MIT License
29 stars 13 forks source link

DocumentReader.showScanner() #10

Closed sghaleb1 closed 3 years ago

sghaleb1 commented 3 years ago

The DocumentReader.showScanner().then() doesn't seem to be working, it expects a Future but does not execute when the scanner is complete or cancelled.

Packages and versions used:

flutter_document_reader_api: ^5.7.0
flutter_document_reader_core_full: ^5.7.0

I am using the example demo given, but I removed the RFID and using OCR only. I cleaned the code to use minimal functions.

The scanner works and gives results after scanning documents, using a controller. But it does not give results in that specific Widget. For example, I click scanner button, I scan document, then setState those results to specific state given. But showScanner() always does the same function, since I cannot pass it parameters.

DocumentReader.showScanner().then((s) {
  print('SUCCESS!');
}).catchError((Object error) =>
    print((error as PlatformException).message));

Nothing prints when I do this, even the catchError doesn't print.

NOTE: The documents even suggest you use .then() method. https://docs.regulaforensics.com/flutter/show-scanner

Hope you are able to help.

Thank you

vyakimchik commented 3 years ago

Hello,

The code snippet in docs has been corrected, thanks! Actually, there are no callbacks in the showScanner function.

sghaleb1 commented 3 years ago

Hello,

The code snippet in docs has been corrected, thanks! Actually, there are no callbacks in the showScanner function.

Alright, thank you for the clarification. Are there any plans to include callback in the future? Or if there is a method to achieve a callback.

vyakimchik commented 3 years ago

No, we are not going to add callbacks as we don't have a sense of it and there is EventChannel. To handle events, you need to use the EventChannel where you can handle the DocumentReaderCompletion actions.

sghaleb1 commented 3 years ago

Thank you for the support. I'll look up EventChannel to fix my problem.