getQueriesData<TQueryData> method

List<(QueryKey, TQueryData?)> getQueriesData<TQueryData>({
  1. required QueryFilters filters,
})

The cached data of every matching query, null where a query holds none yet.

Throws QueryDataTypeError if a matching query holds another type, as getQueryData does — a null there would read as "nothing cached" and hide the bug.

Implementation

List<(QueryKey, TQueryData?)> getQueriesData<TQueryData>({
  required QueryFilters filters,
}) =>
    queryCache.findAll(filters: filters).map((query) {
      if (query.dataType != TQueryData) {
        throw QueryDataTypeError(query.queryKey, TQueryData, query.dataType);
      }
      return (
        query.queryKey,
        query.state.hasData ? query.state.data as TQueryData : null,
      );
    }).toList();