Open nikto-b opened 2 years ago
Just to confirm, this doesn't happen on debug, correct?
Does it happen when you remove the dart2js optimization?
Does it happen with other levels of optimization?
I don't fully know what dart2js-optimization
does, but I suspect that what is happening is that DeviceInfoPlusPlugin
class from device_info_plus_web.dart
gets lost during the optimization.
Just to confirm, this doesn't happen on debug, correct?
Does it happen when you remove the dart2js optimization?
Does it happen with other levels of optimization?
I don't fully know what
dart2js-optimization
does, but I suspect that what is happening is thatDeviceInfoPlusPlugin
class fromdevice_info_plus_web.dart
gets lost during the optimization.
AFAIK, dart2js optimizations can cut off some parts of generated JS code, this can cause problems with DI (google_maps_flutter was optimized-out in release builds for android about year ago, for example)
Thanks for the info! Just in case, the issue you mention is about Java Proguard optimizations on Android, not the dart2js optimization.
Facing the same issue. Can't access the browser info in release mode but can in debug mode.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days
Facing the same issue. No flags. Just with flutter build web --release
i am also facing the same issue. Can't access the browser info in release mode but can in debug mode. This issue raised in july 2022, its 2 years. Is this issue going to be fixed? or is it working fine with any other older versions. If it is not supported by web,i am requesting you to remove that support in pub.dev Thanks Team for your support
This is a community effort, there are no companies behind this project, and it is purely voluntary based.
Unfortunately, this seems to need special knowledge on the dart2js compiler, which no one in the maintainer team has, so external help is definitely needed.
Btw, a message says it works with the O2 optimization, so did you try with the --dart2js-optimization O2
flag?
If anyone can check the different optimization levels from O0
to O4
and report back, that would be very useful, and we can add that to the README
i am doing with flutter build web --web-renderer canvaskit, i am not sure purpose above optimisation
I ran flutter build web --web-renderer canvaskit
on the device_info_plus
example project, then went to build/web
and started a web server with python3 -m http.server
, then I opened http://0.0.0.0:8000/
on my browser.
The app loads correctly.
I repeated the same process with flutter build web --release
and I couldn't reproduce the issue.
I cleaned the project to ensure the build folder was empty, and then run flutter build web --release --dart2js-optimization O4
with the highest level of optimization, then I run the project and I couldn't reproduce the issue.
Tested again with flutter build web --release --dart2js-optimization O4 --web-renderer html
matching the original post just in case and no issues.
If you still have this issue, please provide a repo with that reproduces the error.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days
Platform
Web
Plugin
device_info_plus
Version
4.0.1
Flutter SDK
3.1.0-9.0.pre
Steps to reproduce
webBrowserInfo
getter in any wayUnimplementedError
UnimplementedError: webBrowserInfo() has not been implemented.
Code Sample
No response
Logs