deletefromGeneral method

Future<bool> deletefromGeneral({
  1. required int key,
  2. String? pw,
})

Implementation

Future<bool> deletefromGeneral({
  required int key,
  String? pw,
}) async {
  await _ensureInit(pw: pw);
  final HiveAesCipher? cipher = cipherFromKey(key: pw);
  try {
    final Box<Object> box;
    if (!Hive.isBoxOpen('general')) {
      box = await Hive.openBox('general', encryptionCipher: cipher);
    } else {
      box = Hive.box('general');
    }
    await box.delete(key);
    return true;
  } catch (e) {
    return false;
  }
}