searchGeneral method

Future<Iterable<Object>> searchGeneral({
  1. required bool finder(
    1. Object
    ),
  2. String? pw,
})

Implementation

Future<Iterable<Object>> searchGeneral({
  required bool Function(Object) finder,
  String? pw,
}) async {
  await _ensureInit(pw: pw);
  final HiveAesCipher? cipher = cipherFromKey(key: pw);
  final Box<Object> box;
  if (!Hive.isBoxOpen('general')) {
    box = await Hive.openBox('general', encryptionCipher: cipher);
  } else {
    box = Hive.box('general');
  }
  final Map<dynamic, Object> boxData = box.toMap();
  boxData.removeWhere((dynamic key, Object value) => !finder(value));
  return boxData.values;
}