clearGeneral method

Future<bool> clearGeneral({
  1. String? pw,
})

Implementation

Future<bool> clearGeneral({
  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.clear();
    return true;
  } catch (e) {
    return false;
  }
}