hive
hive copied to clipboard
Storing dart class and List<String> in it, List<String> not getting persisted
I have a class like following
Code sample
@HiveType(typeId: HiveConstants.APP_SETTING_INDEX)
class AppSettings {
AppSettings({
required this.localeString,
required this.searchHistory,
});
@HiveField(0)
String localeString;
@HiveField(1, defaultValue: <String>['default'])
List<String> searchHistory;
}
Now data persists as soon as app is opened, but as soon as app is closed ListsearchHistory with code as 1. localeString is persisted.
Do I need to use .flush() always, I have not been using .flush() and its working fine in all other places.
Version
- Platform: Android
- Flutter version: 3.0.0
- hive hive: ^2.2.2 hive_flutter: ^1.1.0