Open DixomDIY opened 1 year ago
I tried using a later version of quick_usb 0.3.1. And no problems, everything works.
I can confirm that I see the same symptoms for 0.4.0 , but on macOS (Dart 3.0.1). And that forcing the version to 0.3.1 indeed allows avoiding the error.
same issue
[√] Flutter (Channel stable, 3.10.5, on Microsoft Windows [Version 10.0.22621.1848], locale en-CA) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.6.4) [√] Android Studio (version 2022.2) [√] Connected device (4 available) [√] Network resources
same issue:
Android Studio 2021.3 Flutter 3.10.0 (Dart 3.0.0) Android SDK 33.0.0 (Java 11.0.13+) (Xcode 14.3)
Trying with lib version 0.4.0 error log is:
Building macOS application... 2023-06-22 16:08:47.497 xcodebuild[13461:689947] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) --- xcodebuild: WARNING: Using the first of multiple matching destinations: { platform:macOS, arch:arm64, id:00008103-000E61043C62001E } { platform:macOS, arch:x86_64, id:00008103-000E61043C62001E } Debug service listening on ws://127.0.0.1:55901/XNSQgabXg3A=/ws Syncing files to device macOS... 2023-06-22 16:09:01.229 flutter_usb[13596:690430] Warning: Window move completed without beginning [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: LateInitializationError: Field '_instance@28265524' has not been initialized.
.......
Trying with lib version 0.3.1 error log is:
Syncing files to device macOS... [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libusb-1.0.23.dylib': dlopen(libusb-1.0.23.dylib, 0x0001): tried: 'libusb-1.0.23.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibusb-1.0.23.dylib' (no such file), '.../Flutter_usb.app/Contents/Frameworks/FlutterMacOS.framework/Versions/A/./libusb-1.0.23.dylib' (no such file), '.../Flutter_usb/build/macos/Build/Products/Debug/flutter_usb.app/Contents/Frameworks/FlutterMacOS.framework/Versions/A/../../../libusb-1.0.23.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/usr/lib/swift/libusb-1.0.23.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/libusb-1.0.23.dylib' (no such file), '/usr/lib/swift/libusb-1.0.23.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/libusb-1.0.23.dylib' (no such file), '..../flutter_usb.app/Contents/Frameworks/libusb-1.0.23.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '..../flutter_usb.app/Contents/MacOS/Frameworks/libusb-1.0.23.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libusb-1.0.23.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libusb-1.0.23.dylib' (no such file), '.../Flutter_usb/build/macos/Build/Products/Debug/flutter_usb.app/Contents/Frameworks/libusb-1.0.23.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/usr/lib/libusb-1.0.23.dylib' (no such file, not in dyld cache), 'libusb-1.0.23.dylib' (no such file), '/usr/local/lib/libusb-1.0.23.dylib' (no such file), '/usr/lib/libusb-1.0.23.dylib' (no such file, not in dyld cache)
........
Any solution for this problem? Although it works for 0.3.1, I can't open device on linux.
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:quick_usb/src/quick_usb_desktop.dart': Failed assertion: line 118 pos 12: '_devHandle != null': Device not open quick_usb_desktop.dart:118
quick_usb_desktop.dart:118
quick_usb.dart:54
print_usb.dart:47
Even getting a device list causes my entire app to hang, not sure why. This is 0.3.1 (hangs even with proper future handling) 0.4.0 is a non-starter - same issue.
Any alternatives guys ?
Alright i fixed both the error and my laggy issue
1 -> Check your platform and run QuickUsbWindows.registerWith() before init() if you platform is windows. You have functions for each platform. This should solve the initialization error 2 -> if you find the futures are blocking despite waiting for them asynchronously thats natural, you are running all the USB calls on the main thread with high priority. Throw them in an isolate and you should be fine. You have to register, init and exit while in the isolate, dont forget!
I'm using flutter stable channel, recently updated to Flutter 3.10 and Dart 3.0.0. Now the QuickUsb library does not work. After calling var init = await QuickUsb.init(); a LateError occurs (LateInitializationError: field '_instance@326265524' was not initialized).
This happens on the Windows 11 platform, everything is fine on Android. Not tested on other platforms. I tried to clear the cache in .dart_tool, it did not help.