deleteAll<_Model extends T> method

Future<bool> deleteAll<_Model extends T>({
  1. Query? query,
})

Delete every instance that matches query in all providers. Return value reflects if the operation completed without any failures.

Implementation

Future<bool> deleteAll<_Model extends T>({Query? query}) async {
  final modelsToDelete = await get<_Model>(query: query);
  var allDeletesSuccessful = true;
  for (final model in modelsToDelete) {
    final didDelete = await delete<_Model>(model, query: query);
    if (!didDelete) allDeletesSuccessful = false;
  }

  return allDeletesSuccessful;
}