Vaani/lib/db/available_boxes.dart

52 lines
1.6 KiB
Dart
Raw Normal View History

2024-05-08 05:03:49 -04:00
import 'package:flutter/foundation.dart' show immutable;
2025-12-22 15:04:04 +08:00
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';
2024-05-08 05:03:49 -04:00
@immutable
class AvailableHiveBoxes {
const AvailableHiveBoxes._();
2025-12-22 15:04:04 +08:00
static Future<void> init() async {
2025-12-24 18:02:24 +08:00
await Hive.openBox('basicTypes');
2025-12-22 15:04:04 +08:00
/// 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');
}
2025-12-24 18:02:24 +08:00
static final basicBox = Hive.box('basicTypes');
2024-05-08 05:03:49 -04:00
/// Box for storing user preferences as [AppSettings]
2025-12-22 15:04:04 +08:00
static final userPrefsBox = Hive.box<AppSettings>('userPrefs');
2024-05-08 05:03:49 -04:00
/// Box for storing [ApiSettings]
2025-12-22 15:04:04 +08:00
static final apiSettingsBox = Hive.box<ApiSettings>('apiSettings');
2024-05-08 05:03:49 -04:00
/// stores the a list of [AudiobookShelfServer]
static final serverBox =
2025-12-22 15:04:04 +08:00
Hive.box<AudiobookShelfServer>('audiobookShelfServer');
2024-05-08 05:03:49 -04:00
/// stores the a list of [AuthenticatedUser]
static final authenticatedUserBox =
2025-12-22 15:04:04 +08:00
Hive.box<AuthenticatedUser>('authenticatedUser');
/// stores the a list of [BookSettings]
static final individualBookSettingsBox =
2025-12-22 15:04:04 +08:00
Hive.box<BookSettings>('bookSettings');
2024-05-08 05:03:49 -04:00
}