selvam920 / drago_usb_printer

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

Unhandled Exception: MissingPluginException(No implementation found for method getUSBDeviceList on channel drago_usb_printer) #5

Open IsmailALLA2 opened 2 months ago

IsmailALLA2 commented 2 months ago

i did this flutter pub add drago_usb_printer

and after i did this

List<Map<String, dynamic>> devices = []; void getDevices() async { List<Map<String, dynamic>> results = []; results = await DragoUsbPrinter.getUSBDeviceList(); print( length: ${results.length}); devices = results; }

and now i'm getting this :

E/MethodChannel#drago_usb_printer( 7253): Failed to handle method call E/MethodChannel#drago_usb_printer( 7253): kotlin.UninitializedPropertyAccessException: lateinit property usbManager has not been initialized E/MethodChannel#drago_usb_printer( 7253): at app.sks.client.drago_usb_printer.tools.UsbDeviceHelper.queryPrinterDevices(UsbDeviceHelper.kt:80) E/MethodChannel#drago_usb_printer( 7253): at app.sks.client.drago_usb_printer.tools.UsbDeviceHelper.queryLocalPrinterMap(UsbDeviceHelper.kt:47) E/MethodChannel#drago_usb_printer( 7253): at app.sks.client.drago_usb_printer.DragoUsbPrinterPlugin.onMethodCall(DragoUsbPrinterPlugin.kt:84) E/MethodChannel#drago_usb_printer( 7253): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267) E/MethodChannel#drago_usb_printer( 7253): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292) E/MethodChannel#drago_usb_printer( 7253): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319) E/MethodChannel#drago_usb_printer( 7253): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12) E/MethodChannel#drago_usb_printer( 7253): at android.os.Handler.handleCallback(Handler.java:959) E/MethodChannel#drago_usb_printer( 7253): at android.os.Handler.dispatchMessage(Handler.java:100) E/MethodChannel#drago_usb_printer( 7253): at android.os.Looper.loopOnce(Looper.java:232) E/MethodChannel#drago_usb_printer( 7253): at android.os.Looper.loop(Looper.java:317) E/MethodChannel#drago_usb_printer( 7253): at android.app.ActivityThread.main(ActivityThread.java:8705) E/MethodChannel#drago_usb_printer( 7253): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#drago_usb_printer( 7253): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) E/MethodChannel#drago_usb_printer( 7253): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886) E/flutter ( 7253): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, lateinit property usbManager has not been initialized, null, kotlin.UninitializedPropertyAccessException: lateinit property usbManager has not been initialized E/flutter ( 7253): at app.sks.client.drago_usb_printer.tools.UsbDeviceHelper.queryPrinterDevices(UsbDeviceHelper.kt:80) E/flutter ( 7253): at app.sks.client.drago_usb_printer.tools.UsbDeviceHelper.queryLocalPrinterMap(UsbDeviceHelper.kt:47) E/flutter ( 7253): at app.sks.client.drago_usb_printer.DragoUsbPrinterPlugin.onMethodCall(DragoUsbPrinterPlugin.kt:84) E/flutter ( 7253): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267) E/flutter ( 7253): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292) E/flutter ( 7253): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319) E/flutter ( 7253): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12) E/flutter ( 7253): at android.os.Handler.handleCallback(Handler.java:959) E/flutter ( 7253): at android.os.Handler.dispatchMessage(Handler.java:100) E/flutter ( 7253): at android.os.Looper.loopOnce(Looper.java:232) E/flutter ( 7253): at android.os.Looper.loop(Looper.java:317) E/flutter ( 7253): at android.app.ActivityThread.main(ActivityThread.java:8705) E/flutter ( 7253): at java.lang.reflect.Method.invoke(Native Method) E/flutter ( 7253): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) E/flutter ( 7253): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886) E/flutter ( 7253): ) E/flutter ( 7253): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648:7) E/flutter ( 7253): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18) E/flutter ( 7253): E/flutter ( 7253): #2 DragoUsbPrinter.getUSBDeviceList (package:drago_usb_printer/drago_usb_printer.dart:16:31) E/flutter ( 7253): E/flutter ( 7253): #3 ConfigController.getDevices (package:my_pos/controller/config_controller.dart:8:15) E/flutter ( 7253):

devstar1224 commented 1 month ago

@IsmailALLA2 duplicate #3