isar / isar/hive

Hive not persisting data.

Open
#1,159 1 comment 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 was trying to write value while handling notification in background and trying to read data when app is resumed. But problem is data change is not reflected until app is reload.

**Code sample**
```dart
/// Top Level function
@pragma('vm:entry-point')
Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
try {
await HiveStorageOne().initializeStorage();
await HiveStorageOne().saveAccessToken(DateTime.now().second.toString());
} on Exception catch (e) {
print('Error $e');
}
}

/// Somewhere in code while resuming app:
@override
void didChangeAppLifecycleState(AppLifecycleState state) async{
if (state == AppLifecycleState.resumed) {
print("resumed");
await HiveStorageOne().getAccessToken();
}
}

```

Is this expected behavior? What can we do to achieve this ?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the background notification handler and the app lifecycle code shown in the issue, then inspect how HiveStorageOne initializes, saves, and reads the access token. Determine whether the background write and resumed-app read use the same storage context. Done means confirming the expected behavior and documenting or reproducing a reliable way to observe the updated value.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.