-
Notifications
You must be signed in to change notification settings - Fork 52
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
Make pdfrx support Flutter Web with wasm #109
Comments
Basically, because wasm build is not supported on stable channel, I don't ensure that pdfrx runs on it. But I've just removed dependency on js_util. |
Thank you, i am waiting pdfrx support wasm when wasm will be supported on stable channel |
What's the likelihood of getting wasm support, now that it is supported on the stable channel? |
There are several pieces that can be building blocks of pdfrx wasm support:
I didn't check the things deeply, but wasm_ffi lacks struct support and it may be a major blocking issue for the support. |
And, wasm_ffi 0.9.4 was released 16 months ago. The maintainer is not actively maintaining it. |
I need to use Flutter Web with wasm for the application.
``
../../.pub-cache/hosted/pub.dev/pdfrx-1.0.50/lib/src/web/pdf.js.dart:7:1: Error: JS interop library 'dart:js_util' can't be imported when compiling to Wasm.
Try using 'dart:js_interop' or 'dart:js_interop_unsafe' instead.
import 'dart:js_util';
^
../../.pub-cache/hosted/pub.dev/pdfrx-1.0.50/lib/src/web/pdf.js.dart:122:14: Warning: Initializers for parameters are ignored on static interop external functions.
Declare a forwarding non-external function with this initializer, or remove the initializer.
double offsetX = 0,
^
../../.pub-cache/hosted/pub.dev/pdfrx-1.0.50/lib/src/web/pdf.js.dart:123:14: Warning: Initializers for parameters are ignored on static interop external functions.
Declare a forwarding non-external function with this initializer, or remove the initializer.
double offsetY = 0,
^
../../.pub-cache/hosted/pub.dev/pdfrx-1.0.50/lib/src/web/pdf.js.dart:124:12: Warning: Initializers for parameters are ignored on static interop external functions.
Declare a forwarding non-external function with this initializer, or remove the initializer.
bool dontFlip = false});
^
../../.pub-cache/hosted/pub.dev/pdfrx-1.0.50/lib/src/web/pdf.js.dart:168:14: Warning: Initializers for parameters are ignored on static interop external functions.
Declare a forwarding non-external function with this initializer, or remove the initializer.
String intent = 'display',
^
../../.pub-cache/hosted/pub.dev/pdfrx-1.0.50/lib/src/web/pdf.js.dart:169:11: Warning: Initializers for parameters are ignored on static interop external functions.
Declare a forwarding non-external function with this initializer, or remove the initializer.
int annotationMode = 1,
^
../../.pub-cache/hosted/pub.dev/pdfrx-1.0.50/lib/src/web/pdf.js.dart:170:12: Warning: Initializers for parameters are ignored on static interop external functions.
Declare a forwarding non-external function with this initializer, or remove the initializer.
bool renderInteractiveForms = false,
^
../../.pub-cache/hosted/pub.dev/pdfrx-1.0.50/lib/src/web/pdf.js.dart:207:10: Warning: Initializers for parameters are ignored on static interop external functions.
Declare a forwarding non-external function with this initializer, or remove the initializer.
bool includeMarkedContent = false,
^
../../.pub-cache/hosted/pub.dev/pdfrx-1.0.50/lib/src/web/pdf.js.dart:208:10: Warning: Initializers for parameters are ignored on static interop external functions.
Declare a forwarding non-external function with this initializer, or remove the initializer.
bool disableNormalization = false,
^
../../.pub-cache/hosted/pub.dev/pdfrx-1.0.50/lib/src/web/pdf.js.dart:267:12: Warning: Initializers for parameters are ignored on static interop external functions.
Declare a forwarding non-external function with this initializer, or remove the initializer.
String intent = 'display',
^
../../.pub-cache/hosted/pub.dev/pdfrx-1.0.50/lib/src/web/pdfrx_web.dart:6:1: Error: JS interop library 'dart:js_util' can't be imported when compiling to Wasm.
Try using 'dart:js_interop' or 'dart:js_interop_unsafe' instead.
import 'dart:js_util' as js_util;
^
Command: /Users/daydelight/fvm/versions/master/bin/cache/dart-sdk/bin/dart compile wasm --packages=.dart_tool/package_config.json
--extra-compiler-option=--dart-sdk=/Users/daydelight/fvm/versions/master/bin/cache/dart-sdk
--extra-compiler-option=--platform=/Users/daydelight/fvm/versions/master/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/4f6b832c8e333775f2c217a821050543a110826e/ -DFLUTTER_WEB_AUTO_DETECT=false -DFLUTTER_WEB_USE_SKIA=false
-DFLUTTER_WEB_USE_SKWASM=true --extra-compiler-option=--depfile=/Users/daydelight/study/webassembly/.dart_tool/flutter_build/b49f125fa6955c85159dd2d865c4d882/dart2wasm.d -O4 --no-name-section -o
/Users/daydelight/study/webassembly/.dart_tool/flutter_build/b49f125fa6955c85159dd2d865c4d882/main.dart.wasm
/Users/daydelight/study/webassembly/.dart_tool/flutter_build/b49f125fa6955c85159dd2d865c4d882/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:297: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:119: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... 17.2s
Error: Failed to compile application for the Web.
``
The text was updated successfully, but these errors were encountered: