plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[Bug]: Wasm illegal cast

Open flrnsbt opened this issue 1 year ago • 5 comments

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

  • [X] I searched issues in this repository and couldn't find such bug/problem
  • [X] I Google'd a solution and I couldn't find it
  • [X] I searched on StackOverflow for a solution and I couldn't find it
  • [X] I read the README.md file of the plugin
  • [X] I'm using the latest version of the plugin
  • [X] All dependencies are up to date with flutter pub upgrade
  • [X] I did a flutter clean
  • [X] I tried running the example project

flrnsbt avatar May 27 '24 09:05 flrnsbt

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

github-actions[bot] avatar Aug 26 '24 00:08 github-actions[bot]

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

arnaudruffin avatar Sep 11 '24 09:09 arnaudruffin

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

arnaudruffin avatar Sep 11 '24 14:09 arnaudruffin

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

miquelbeltran avatar Sep 11 '24 20:09 miquelbeltran

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

arnaudruffin avatar Sep 12 '24 06:09 arnaudruffin

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

github-actions[bot] avatar Dec 12 '24 00:12 github-actions[bot]