deleteAll<T> method

  1. @override
Future deleteAll<T>([
  1. Type? type
])
override

Deletes all entities of the specified type from this Box.

Implementation

@override
Future deleteAll<T>([Type? type]) async {
  var connection = await _connect();
  var documentType = registry.lookup(type ?? T).name;
  try {
    var documents = await connection.list(documentType);
    for (var document in documents) {
      await connection.delete(documentType, document.key);
    }
  } catch (e) {
    print(e); // TODO: find out why this happens
  }
}