delete method

Future<void> delete(
  1. String key, [
  2. Transaction? txn
])

Implementation

Future<void> delete(String key, [Transaction? txn]) async {
  if (boxCollection._txnCache != null) {
    boxCollection._txnCache!.add((txn) => delete(key, txn));
    _cache.remove(key);
    _cachedKeys?.remove(key);
    return;
  }

  txn ??= boxCollection._db.transaction(name, 'readwrite');
  final store = txn.objectStore(name);
  await store.delete(key);
  _cache.remove(key);
  _cachedKeys?.remove(key);
  return;
}