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

Support Web #32

Open
kuruhuru opened this issue Feb 18, 2024 · 2 comments
Open

Support Web #32

kuruhuru opened this issue Feb 18, 2024 · 2 comments

Comments

@kuruhuru
Copy link

Hi! Excellent package! Do you plan to add web?

@veloce
Copy link
Collaborator

veloce commented Feb 18, 2024

There's no plan to support web at the moment.

@romaingyh
Copy link

Hi, it's an old issue but for future readers interested in using this package on web :

Blocking part is SquareSet.dart which uses full precision 64 bit integers that javascript cannot represent exactly, however you can use this package (and by extension chessground) with flutter for web assembly.

flutter run -d chrome --wasm
flutter build web --release --wasm

Web assembly support dart 64bit integers. Web assembly is not yet fully supported by all browsers for now (chrome ok but no firefox and safari) but it seems Flutter web is going that way for future.

If you can't wait for safari and firefox support of WA, your solutions are to rewrite SquareSet.dart :

  • As a class storing a BigInt and replace all 64bit integers with BigInt.parse('0x....'). This pub package has done this work but is a bit outdated compared to dartchess.
  • As a class storing two 32 bit integer, low part and hight part. Like this typescript implementation.

In both cases, you'll lose performance compared with extension type on int in the current implementation, but I don't know if that has any real impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants