kechankrisna / flutter_usb_printer

GNU General Public License v3.0
6 stars 50 forks source link

Cannot connect to printer device #26

Open mftlhn opened 11 months ago

mftlhn commented 11 months ago

Hi... I had just try this package. My printer used USB to connect. When connected, the printer device can be detected. But when I click the device in list, It just restarted.

I had just edited the _connect function. _connect(int vendorId, int productId) async { bool? returned = false; try { returned = await flutterUsbPrinter.connect(vendorId, productId); debugPrint(devices.toList().toString()); } on PlatformException { //response = 'Failed to get platform version.'; debugPrint("Failed to get platform version"); } if (returned!) { setState(() { connected = true; }); } }

When I click the list of device, it reproduce error like this : E/MethodChannel#flutter_usb_printer(32636): at android.hardware.usb.IUsbManager$Stub.onTransact(IUsbManager.java:619) E/MethodChannel#flutter_usb_printer(32636): at android.os.Binder.execTransactInternal(Binder.java:1281) E/MethodChannel#flutter_usb_printer(32636): at android.os.Binder.execTransact(Binder.java:1244) E/MethodChannel#flutter_usb_printer(32636): I/flutter (32636): Failed to get platform version

am I did something wrong?