2025-12-22 15:04:04 +08:00
|
|
|
import 'package:hive_ce_flutter/hive_flutter.dart';
|
|
|
|
|
import 'package:vaani/db/available_boxes.dart';
|
2025-11-14 16:34:42 +08:00
|
|
|
import 'package:vaani/globals.dart';
|
2024-05-08 05:03:49 -04:00
|
|
|
|
|
|
|
|
import 'register_models.dart';
|
|
|
|
|
|
2024-10-03 05:54:29 -04:00
|
|
|
// does the initial setup of the storage
|
2024-05-08 05:03:49 -04:00
|
|
|
Future initStorage() async {
|
2025-11-14 16:34:42 +08:00
|
|
|
// final dir = await getApplicationDocumentsDirectory();
|
2024-05-08 05:03:49 -04:00
|
|
|
|
2025-11-14 16:34:42 +08:00
|
|
|
// // use vaani as the directory for hive
|
|
|
|
|
// final storageDir = Directory(
|
|
|
|
|
// p.join(dir.path, appName),
|
|
|
|
|
// );
|
|
|
|
|
// await storageDir.create(recursive: true);
|
2024-05-08 05:03:49 -04:00
|
|
|
|
2025-12-22 15:04:04 +08:00
|
|
|
Hive.initFlutter(appName);
|
|
|
|
|
// Hive.defaultDirectory = appDocumentsDir.path;
|
|
|
|
|
// appLogger.config('Hive storage directory init: ${Hive.defaultDirectory}');
|
2024-05-08 05:03:49 -04:00
|
|
|
|
|
|
|
|
await registerModels();
|
2025-12-22 15:04:04 +08:00
|
|
|
await AvailableHiveBoxes.init();
|
2024-05-08 05:03:49 -04:00
|
|
|
}
|