-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix web compilation #88
base: v3
Are you sure you want to change the base?
fix web compilation #88
Conversation
I just realized that the hashing library (xxh3) itself also contains large integers that cannot be represented in javascript, fml.
However, I am pretty sure it is possible to implement the hashing algorithm in a JavaScript compatible way. I will continue working on this |
still crashes when you attempt to call xxh3() in js runtime tho
okay, I fixed the issue that I described in my previous comment in a very dirty way. basically, I just moved all of the code from https://pub.dev/packages/xxh3 into this package, and modified it in such a way that you can compile for javascript without getting the integer literal compile time error. however, the xxh3 algorithm still doesn't work in javascript, the exception is just moved to the runtime instead. so basically, with my branch, you can import isar into your flutter project, use isar in all support platforms that are not web, and compile for web without errors. attempting to use isar on web will cause runtime errors. why would this benefit anyone? we are using isar as part of a shared package that we use throughout many apps, including web apps. with the integer literal compilation error, we could no longer import that shared package in web apps and compile the app, even if we didn't use the isar part of the shared package in the web apps. and apparently, other people have similar issues. if you are one of those people/companies, you're welcome. however, I find this solution pretty ugly. therefore, I am not sure whether this PR should really be merged. maybe you can use it as an inspiration to come up with a proper solution that actually WORKS on web, not just enables compilation. I, unfortunately, don't have time to continue down this rabbit hole |
Have you tried this? |
I tried that before I started working on this. I did not work. I can't remember what the exact problem was but I think the app wouldn't compile |
Instead of storing the ids of the isar collections as integers, I moved the generation of those integers (which are just hashes of the name property) to runtime. this way, the dart code does not contain integers that cannot be represented in javascript.