hive切换hive_ce

This commit is contained in:
rang 2025-12-22 15:04:04 +08:00
parent 3362a254ff
commit 6efa41e035
30 changed files with 1403 additions and 2566 deletions

View file

@ -1,5 +1,5 @@
import 'package:flutter/foundation.dart' show immutable;
import 'package:hive/hive.dart';
import 'package:hive_ce/hive.dart';
import 'package:vaani/features/per_book_settings/models/book_settings.dart';
import 'package:vaani/features/settings/models/models.dart';
@ -7,21 +7,41 @@ import 'package:vaani/features/settings/models/models.dart';
class AvailableHiveBoxes {
const AvailableHiveBoxes._();
static Future<void> init() async {
/// Box for storing user preferences as [AppSettings]
await Hive.openBox<AppSettings>('userPrefs');
/// Box for storing [ApiSettings]
await Hive.openBox<ApiSettings>('apiSettings');
/// stores the a list of [AudiobookShelfServer]
await Hive.openBox<AudiobookShelfServer>('audiobookShelfServer');
/// stores the a list of [AuthenticatedUser]
await Hive.openBox<AuthenticatedUser>('authenticatedUser');
/// stores the a list of [BookSettings]
await Hive.openBox<BookSettings>('bookSettings');
}
/// Box for storing user preferences as [AppSettings]
static final userPrefsBox = Hive.box<AppSettings>(name: 'userPrefs');
static final userPrefsBox = Hive.box<AppSettings>('userPrefs');
/// Box for storing [ApiSettings]
static final apiSettingsBox = Hive.box<ApiSettings>(name: 'apiSettings');
static final apiSettingsBox = Hive.box<ApiSettings>('apiSettings');
/// stores the a list of [AudiobookShelfServer]
static final serverBox =
Hive.box<AudiobookShelfServer>(name: 'audiobookShelfServer');
Hive.box<AudiobookShelfServer>('audiobookShelfServer');
/// stores the a list of [AuthenticatedUser]
static final authenticatedUserBox =
Hive.box<AuthenticatedUser>(name: 'authenticatedUser');
Hive.box<AuthenticatedUser>('authenticatedUser');
/// stores the a list of [BookSettings]
static final individualBookSettingsBox =
Hive.box<BookSettings>(name: 'bookSettings');
Hive.box<BookSettings>('bookSettings');
}