patch static method

Future<void> patch({
  1. Iterable<String>? itemsToDelete,
  2. Map<String, dynamic>? itemsToSet,
})

Apply patch to storage.

It will do deletion first, then set items.

Implementation

static Future<void> patch({
  Iterable<String>? itemsToDelete,
  Map<String, dynamic>? itemsToSet,
}) async {
  assert(_box != null, 'call "prelude" first');
  assert(itemsToSet != null || itemsToDelete != null, 'Nothing to patch.');

  if (itemsToDelete != null) await _box!.deleteAll(itemsToDelete);
  if (itemsToSet != null) await _box!.putAll(itemsToSet);
}