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

Fails to compile to wasm because of flutter_keyboard_visibility #210

Open
paurakhsharma opened this issue May 21, 2024 · 5 comments
Open
Labels
bug Something isn't working in triage

Comments

@paurakhsharma
Copy link

paurakhsharma commented May 21, 2024

Bug report

wolt_modal_sheet is failing to compile to wasm because flutter_keyboard_visibility depends on dart:html.
There is already a 3 months old issue on flutter_keyboard_visibiliy but still it isn't fixed.
MisterJimson/flutter_keyboard_visibility#150

I am not sure how wolt_modal_sheet would get around it but I am creating this issue to track the problem.

Steps to reproduce

Steps to reproduce the behavior:

  1. Add the latest wolt_modal_sheet to the project. Right now it is 0.5.0
  2. Make sure you are on Flutter wasm supporting version of Flutter i.e >3.22.0
  3. Compile the project to web wasm using flutter build web --wasm
  4. See the error

Expected behavior

The project to compile successfully.


Current behavior

Fails with error message:

```

┌─ New feature ────────────────────────────────────────────────────────────────────────────┐
│ WebAssembly compilation is new. Understand the details before deploying to production. │
│ See https://flutter.dev/wasm for more information. │
└──────────────────────────────────────────────────────────────────────────────────────────┘

Target dart2wasm failed: ProcessException: Process exited abnormally with exit code 64:
NOTE: Compilation to WasmGC is experimental.
The support may change, or be removed, with no advance notice.

../../../../.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_web-2.0.0/lib/flutter_keyboard_visibility_web.dart:1:8: Error: Dart
library 'dart:html' is not available on this platform.
import 'dart:html' as html show window, Navigator;
^
Context: The unavailable library 'dart:html' is imported through these packages:

web_plugin_registrant.dart => package:flutter_keyboard_visibility_web => dart:html

Detailed import paths for (some of) the these imports:

main.dart => web_plugin_registrant.dart => package:flutter_keyboard_visibility_web/flutter_keyboard_visibility_web.dart => dart:html

../../../../.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_web-2.0.0/lib/flutter_keyboard_visibility_web.dart:10:35: Error: Type
'html.Navigator' not found.
FlutterKeyboardVisibilityPlugin(html.Navigator navigator);
^^^^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_web-2.0.0/lib/flutter_keyboard_visibility_web.dart:10:40: Error:
'Navigator' isn't a type.
FlutterKeyboardVisibilityPlugin(html.Navigator navigator);
^^^^^^^^^
../../../../.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_web-2.0.0/lib/flutter_keyboard_visibility_web.dart:16:46: Error: Undefined
name 'window'.
FlutterKeyboardVisibilityPlugin(html.window.navigator);
^^^^^^
Command: /Users/paurakh/development/flutter/bin/cache/dart-sdk/bin/dart compile wasm --packages=.dart_tool/package_config.json
--extra-compiler-option=--dart-sdk=/Users/paurakh/development/flutter/bin/cache/dart-sdk
--extra-compiler-option=--platform=/Users/paurakh/development/flutter/bin/cache/flutter_web_sdk/kernel/dart2wasm_platform.dill
--extra-compiler-option=--delete-tostring-package-uri=dart:ui --extra-compiler-option=--delete-tostring-package-uri=package:flutter
--extra-compiler-option=--import-shared-memory --extra-compiler-option=--shared-memory-max-pages=32768 -Ddart.vm.product=true
-DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/f6344b75dcf861d8bf1f1322780b8811f982e31a/
-DFLUTTER_WEB_AUTO_DETECT=false -DFLUTTER_WEB_USE_SKIA=false -DFLUTTER_WEB_USE_SKWASM=true
--extra-compiler-option=--depfile=/Users/paurakh/projects/scoutredeem/GNFE/mobile_client/.dart_tool/flutter_build/2bc6bf09fa388c3aa3580c6c
6256f0e7/dart2wasm.d -O4 --no-name-section -o
/Users/paurakh/projects/scoutredeem/GNFE/mobile_client/.dart_tool/flutter_build/2bc6bf09fa388c3aa3580c6c6256f0e7/main.dart.wasm
/Users/paurakh/projects/scoutredeem/GNFE/mobile_client/.dart_tool/flutter_build/2bc6bf09fa388c3aa3580c6c6256f0e7/main.dart
0 RunResult.throwException (package:flutter_tools/src/base/process.dart:125:5)
1 _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:321:19)

2 Dart2WasmTarget.build (package:flutter_tools/src/build_system/targets/web.dart:329:5)

3 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:875:9)

4 Future.wait. (dart:async/future.dart:524:21)

5 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32)

6 Future.wait. (dart:async/future.dart:524:21)

7 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32)

8 FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:642:16)

9 WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:92:34)

10 BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:230:5)

11 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1394:27)

12 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19)

13 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

14 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:372:9)

15 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19)

16 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:308:5)

17 run.. (package:flutter_tools/runner.dart:130:9)

18 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19)

19 main (package:flutter_tools/executable.dart:93:3)

Compiling lib/main.dart for the Web... 22.0s
Error: Failed to compile application for the Web.

</p>
</details> 
---
@paurakhsharma paurakhsharma added bug Something isn't working in triage labels May 21, 2024
@paurakhsharma
Copy link
Author

Flutter doctor output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.0, on macOS 14.3.1 23D60 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.89.1)
[✓] Connected device (4 available)
    ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the
      same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

• No issues found!

@ulusoyca
Copy link
Collaborator

This is a very good catch. Thanks for the reporting. We will be following it.

@ulusoyca
Copy link
Collaborator

@paurakhsharma How urgent is this issue? Depending on the urgency, I can have a separate build in pub without dependency to this package but you will lose the goodies for the pages that have keyboard.

@paurakhsharma
Copy link
Author

Thank you @ulusoyca for the quick response. It is not mission critical for us. I am going through the packages we use in our project to see if wasm deployment is possible. Currently there are few other packages that prevent us including this one. So, it will be some time before we can compile to wasm.

So, I would appreciate it if there is a wasm compitable version of this package but it's not blocking us so you can take your time for proper fix.

@ulusoyca
Copy link
Collaborator

ulusoyca commented Jun 6, 2024

Looking for wider help here:

https://x.com/ulusoyapps/status/1798636814850277587

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in triage
Projects
None yet
Development

No branches or pull requests

2 participants