algolia / algolia/algoliasearch-helper-flutter
[bug]: Crash on storage of user token with wasm
- Dominant language
- Dart
- Stars
- 27
- Forks
- 21
- Avg merge
- 1h 19m
- Merged PRs (30d)
- 1
Description
**Describe the bug 🐛**
Hive is not compatible with wasm and seems to be not maintained anymore. Maybe try with [hive_ce](https://pub.dev/packages/hive_ce) which is wasm compatible
I'm unable to locate the exact line that trigger the crash but I think it is insights.userToken = 'user-123';
**To Reproduce 🔍**
Try to use `insights.userToken = 'user-123';` in a project with `insights`, even without seting the userToken it should crash because I think it is the read that crashes.
On initialization it outputs this:
```shell
```
**Expected behavior 💭**
No crash
**Environment:**
algolia_insights: ^1.0.2
Build with `--wasm`
[!] Flutter (Channel [user-branch], 3.29.2, on macOS 15.3.2 24D81 darwin-arm64, locale en-US)
! Flutter version 3.29.2 on channel [user-branch] at /Users/ortes/flutter
Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
! Upstream repository unknown source is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[!] Xcode - develop for iOS and macOS (Xcode 16.2)
✗ CocoaPods not installed.
CocoaPods is a package manager for iOS or macOS platform code.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/to/platform-plugins
For installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.98.0)
[✓] Connected device (3 available)
[✓] Network resources
! Doctor found issues in 2 categories.
Contributor guide
Research direction
Start by reproducing the crash in a Flutter project using algolia_insights: ^1.0.2 and a --wasm build, focusing on the insights.userToken getter and setter. Trace the user-token storage path and check the reported Hive or hive_ce compatibility; done means reading or assigning the token no longer crashes under wasm.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter, wasm
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100