Closed h1376h closed 3 months ago
Points for submitting this as a (failing) test w/ the fix!
Fix:
Changing values in lib/src/sha512_fastsinks.dart
(for example: 0x6a09e667f3bcc908
) to:
BigInt.parse('0x6a09e667f3bcc908').toInt()
and using another additional conditional import
The issue now only appears when forcing to use fast sinks on Wasm build.
import 'sha512_fastsinks.dart' if (dart.library.html) 'sha512_slowsinks.dart';
->
import 'sha512_fastsinks.dart';
This fails on Wasm builds.
import 'sha512_fastsinks.dart' if (dart.library.html) 'sha512_slowsinks.dart';
->
import 'sha512_slowsinks.dart';
This doesn't fail on Wasm builds.
Conditional imports change and adding a fast sinks only for Wasm build:
import 'sha512_fastsinks.dart'
if (dart.library.html) 'sha512_slowsinks.dart'
if (dart.library.js_interop) 'sha512_fastsinks_wasm.dart';
I still can't really understand the root of the problem
Even with the --wasm flag, flutter build web will still compile the application to JavaScript. If WasmGC support is not detected at runtime, the JavaScript output is used so the application will continue to work across browsers.
This was the root of the problems with my tests.
Current changes should work fine, this issue could be closed and by publishing the changes and using fast sinks on Wasm when possible, everything should be a lot faster. (4 seconds -> 1 seconds)
I apologize for the incorrect bug report.
@h1376h – so we can close this bug?
@kevmoo Yeah, I closed it. Couldn't find any bug/problems with the current conditional imports after clearing cache and some tests.
Sample code:
This code works when using slow sinks, but gives errors now (on master) using fast sinks
flutter build web --wasm
cd build/web
dhttpd '--headers=Cross-Origin-Embedder-Policy=credentialless;Cross-Origin-Opener-Policy=same-origin'