fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.56k stars 940 forks source link

[Bug]: Wasm illegal cast #2966

Open flrnsbt opened 3 months ago

flrnsbt commented 3 months ago

Platform

Web

Plugin

package_info_plus

Version

8.0.0

Flutter SDK

3.22.1 stable

Steps to reproduce

Use the packageInfoPlus package in any web app that you compile in wasm

Code Sample

No response

Logs

Uncaught RuntimeError: illegal cast
    at PackageInfoPlusWebPlugin.getAll inner (main.dart.wasm:0x5f030a)
    at _awaitHelperWithTypeCheck closure at org-dartlang-sdk:///dart-sdk/lib/_internal/wasm/lib/async_patch.dart:97:16 (main.dart.wasm:0x31d543)
    at closure wrapper at org-dartlang-sdk:///dart-sdk/lib/_internal/wasm/lib/async_patch.dart:97:16 trampoline (main.dart.wasm:0x31d62a)
    at _RootZone.runUnary (main.dart.wasm:0x31e10d)
    at _Future._propagateToListeners (main.dart.wasm:0x31dd21)
    at _Future._completeWithValue (main.dart.wasm:0x31e393)
    at _Future._asyncCompleteWithValue closure at org-dartlang-sdk:///dart-sdk/lib/async/future_impl.dart:721:29 (main.dart.wasm:0x31f629)
    at closure wrapper at org-dartlang-sdk:///dart-sdk/lib/async/future_impl.dart:721:29 trampoline (main.dart.wasm:0x31f640)
    at _startMicrotaskLoop (main.dart.wasm:0x31c9a3)
    at _startMicrotaskLoop tear-off trampoline (main.dart.wasm:0x31ca0d)

Flutter Doctor

florian@ubuntuflorian:~/Documents/flutter/pouwfrontend$ flutter --version
Flutter 3.22.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision a14f74ff3a (5 days ago) • 2024-05-22 11:08:21 -0500
Engine • revision 55eae6864b
Tools • Dart 3.4.1 • DevTools 2.34.3

Checklist before submitting a bug

github-actions[bot] commented 3 weeks ago

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

arnaudruffin commented 1 week ago

Hi. I am facing the same issue, please reopen.

arnaudruffin commented 1 week ago

I think I missed something. The issue is with device_info_plus and not package_info_plus, tell me if I need to open a new issue.

In the meantime:

Plugin : device_info_plus

Version device_info_plus: ^10.1.2

Flutter SDK 3.24.2 stable

Steps to reproduce use device_info_plus in a project compile for webasm. It compiles, but on the execution you got illegal cast errors. Try the sample code below. flutter build web --wasm --no-strip-wasm cd build/web dhttpd '--headers=Cross-Origin-Embedder-Policy=credentialless;Cross-Origin-Opener-Policy=same-origin'

You will get main.dart.wasm:0x14d826 Uncaught RuntimeError: illegal cast at DeviceInfoPlusWebPlugin.deviceInfo (main.dart.wasm:0x14d826) at DeviceInfoPlugin.webBrowserInfo inner (main.dart.wasm:0x14d4ef) in the browser console.

Sample: https://github.com/arnaudruffin/demo-asm-issue-in-deviceinfo, which is the example given from the documentation, only targeting web platform.

See https://docs.flutter.dev/platform-integration/web/wasm for more info

miquelbeltran commented 6 days ago

Ah, yes, we should have a different ticket for each project, since it doesn't look it's exactly the same error cause.

arnaudruffin commented 6 days ago

Ok, i'll do it thanks. edit: done: https://github.com/fluttercommunity/plus_plugins/issues/3253