isar / isar/hive

Can't save to boxes inside listener

Open
#988 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Dart
Stars
4.4k
Forks
449
PR merge metrics
No merged PRs in 30d

Description

**Question**
I'm running Just Audio player and using a listener. Every time the listener changes the index, I want to save that new index to a box ,but it won't save anything inside the listener. If l put the same code inside an onTap event or likewise than it works.
Why is it not working inside the listener?
**Code sample**
_player.positionStream.listen((event) {
if (event) ...
List exampleList =[1,2,3,4,5,6,7,8];
final boxEpisodeInt = Hive.box>("EpisodeInt");
boxEpisodeInt.put(newList, exampleList);
...

Provide a few simple lines of code to show your problem.
final boxEpisodeInt = Hive.box>("EpisodeInt");
List exampleList =[1,2,3,4,5,6,7,8]
boxEpisodeInt.put(newList, exampleList);

**Version**
- Android API 31
- 2.10.3 • channel stable
- hive: ^2.0.4

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided positionStream listener snippet and compare its Hive box access and put call with the working onTap case. Reproduce the listener-triggered write using the supplied example list, checking the box setup and the unspecified newList key. Done means the cause of the missing write is confirmed and a listener write can be observed in the box.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
database, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.