Vaani/lib/db/init.dart

24 lines
699 B
Dart
Raw Normal View History

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';
// 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-24 22:39:07 +08:00
await Hive.initFlutter(appName);
2025-12-22 15:04:04 +08:00
// 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
}