import 'package:hive/hive.dart'; class StorageService { static late final String appDocsDir; static late final String appTempsDir; static Future setValue({ required String key, required dynamic value, required String boxName, }) async { final Box box = await Hive.openBox(boxName); await box.put(key, value); await box.close(); } static Future getValue({required String key, required String boxName}) async { final Box box = await Hive.openBox(boxName); final value = await box.get(key); await box.close(); return value; } static Future setBoxData({ required Map data, required String boxName, }) async { final Box box = await Hive.openBox(boxName); await box.putAll(data); await box.close(); } static Future getBoxData({required String boxName}) async { final Box box = await Hive.openBox(boxName); await box.close(); return box.toMap(); } static Future boxExists({required String boxName}) async { final bool result = await Hive.boxExists(boxName); return result; } }