exists<_Model extends _RepositoryModel> method

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

Check if a _Model is accessible locally. First checks if there's a matching query in memoryCacheProvider and then check sqliteProvider. Does not query remoteProvider.

Implementation

Future<bool> exists<_Model extends _RepositoryModel>({
  Query? query,
}) async {
  if (memoryCacheProvider.canFind<_Model>(query)) {
    final results = memoryCacheProvider.get<_Model>(query: query, repository: this);

    return results?.isNotEmpty ?? false;
  }

  return await sqliteProvider.exists<_Model>(query: query, repository: this);
}