Vaani/lib/db/available_boxes.dart
2025-12-22 15:04:04 +08:00

47 lines
1.5 KiB
Dart

import 'package:flutter/foundation.dart' show immutable;
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';
@immutable
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>('userPrefs');
/// Box for storing [ApiSettings]
static final apiSettingsBox = Hive.box<ApiSettings>('apiSettings');
/// stores the a list of [AudiobookShelfServer]
static final serverBox =
Hive.box<AudiobookShelfServer>('audiobookShelfServer');
/// stores the a list of [AuthenticatedUser]
static final authenticatedUserBox =
Hive.box<AuthenticatedUser>('authenticatedUser');
/// stores the a list of [BookSettings]
static final individualBookSettingsBox =
Hive.box<BookSettings>('bookSettings');
}