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

Running Flutter Web App in release-mode leads to error #13

Open
iKK001 opened this issue Nov 16, 2024 · 1 comment
Open

Running Flutter Web App in release-mode leads to error #13

iKK001 opened this issue Nov 16, 2024 · 1 comment

Comments

@iKK001
Copy link

iKK001 commented Nov 16, 2024

In debug mode, my Flutter Web Application successfully connects to my usbDevice.

My USB-device is an ESP32-S3.

And I am on Flutter version 3.24.4 • channel stable • https://github.com/flutter/flutter.git
(Dart 3.5.4 • DevTools 2.37.3)
I tried in Chrome, Edge and Safari Browsers.

I am able to successfully connect my USB-device with usbDevice.requestDevices(...) cmd inside the browser.

However, if I run my Flutter Web Application in release mode, then the usbDevice connection-popup does not show up and an error occurs.

i.e. if I try to run my Flutter Web app with the following cmd (i.e. in release mode), then the usbDevice connection code crashes

flutter run -d chrome --release

Here is my call of the connect method inside Flutter Web:

Future<void> _connectToDevice() async {
    try {
      pairedDevice = await usbDevice
          .requestDevices([DeviceFilter(vendorId: 0x303a, productId: 0x1001)]);
    } catch (e) {
      Utils.showSnackBar(e.toString(), Colors.red);      
      setState(() => _status = 'Error: $e');
    }
  }

And the following error message is shown:

Invalid argument: Instance of 'minified:UK'

What can I do to make my Flutter Web application run in release mode ??

@iKK001 iKK001 changed the title Running in release leads to error Running Flutter Web App in release-mode leads to error Nov 16, 2024
@iKK001
Copy link
Author

iKK001 commented Nov 21, 2024

This library does not seem to be very recent anymore. At least without a very big, active community. Otherwise, I would have received an answer earlier. Please correct me if I am wrong.

Anyway, I have found a workaround:

I now use this Flutter package, called web_usb

And with some modifications to fit my device (especially concerning the endpoint-addressing), I have a working solution now that fully works also if running in release mode:

flutter run -d chrome --release

Please refer to my stackoverflow discussion. Maybe there are ideas or even solutions to address this library's issue in release mode.

However, I find your library better in a sense that it is much more complete with helper methods.

Is there a way to make it work for release mode ???

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

1 participant