Open bradintheusa opened 1 month ago
Is your intention just to compile (but not use) this in a project for web? (i.e., your app uses xxh3 on native platforms only) or do you intend to use this package on the web?
This package isn't currently web compatible. Even if you manage to get it to compile it would produce blatantly wrong values (because of the JavaScript integer limit being 2^53 not 2^64).
I could make it compile and throw at runtime if you just wanted to include the package in a project that used it on native platforms but not the web.
It's probably not possible to enable the package to be functional and compilable to JavaScript without taking a massive performance hit by using BigInt everywhere (as xxh3 works on 64-bit numbers).
I've just done some investigation and looks like WebAssembly should be viable. In fact, I've just written an npm package that uses WebAssembly generated from this package.
I'm not sure what that would look like in the context of, say a Flutter application (I would probably just bundle the Wasm module) but if you're actually interested in using this package on the web, I can start looking at trying to add web support using WebAssembly instead.
I think just change it to not support web for now https://docs.flutter.dev/packages-and-plugins/developing-packages#plugin-platforms
Runtime errors would be the worst solution.
I get this runtime error in my web project after adding the package:
Not sure if it can be fixed or this is not a web compatible package.