import 'package:hive_flutter/hive_flutter.dart'; import 'package:konectar_events/model/hive_api_constants.dart'; class HiveOperations { static Future saveApiConstants(List hiveList) async { late Box hiveApiConstantsBox; hiveApiConstantsBox = await Hive.openBox('hiveApiConstants'); hiveApiConstantsBox.addAll(hiveList); } static Future checkIfApiExists(String api, String moduleName) async { late Box hiveApiConstantsBox; hiveApiConstantsBox = await Hive.openBox('hiveApiConstants'); List list = hiveApiConstantsBox.values.toList(); return list.indexWhere( (element) => element.functionName == api && element.module == moduleName, ) == -1 ? false : true; } }