removeAll method

Future<void> removeAll({
  1. required String category,
  2. Map<String, dynamic>? tagFilter,
})

Removes all records matching a category and tag filter.

Throws an AskarSessionException if the session is closed.

Implementation

Future<void> removeAll({
  required String category,
  Map<String, dynamic>? tagFilter,
}) async {
  _throwOnNullHandle('Cannot remove all with a closed session');

  try {
    final removeAllResult = await askarSessionRemoveAll(
      handle!,
      category,
      tagFilter: tagFilter,
    );

    removeAllResult.errorCode.throwOnError();
  } catch (e) {
    throw AskarSessionException('Failed to remove all on session: $e');
  }
}