saveAll method

Future<bool> saveAll({
  1. required List<Resource> resources,
  2. String? pw,
})

The built-in bulkSave (called addAll) for Hive only allows automatically generated, incremented (int) IDs, so this function really just calls the save function over and over

Implementation

Future<bool> saveAll({
  required List<Resource> resources,
  String? pw,
}) async {
  for (final Resource resource in resources) {
    try {
      await save(resource: resource, pw: pw);
    } catch (e) {
      return false;
    }
  }
  return true;
}