useEntityList<T extends Object> function

AsyncValue<EntityListSnapshot<T>> useEntityList<T extends Object>(
  1. WidgetRef ref, {
  2. required String type,
  3. required String queryKey,
  4. required EntityDecoder<T> fromGraph,
  5. EntityEncoder<T>? toGraph,
  6. ListQuery query = const ListQuery(),
  7. ViewCompleteness completeness = ViewCompleteness.remote,
  8. bool enabled = true,
  9. bool subscribe = true,
})

Watches a normalized list identified by type + queryKey.

completeness selects the view lane — local, remote, or hybrid. It defaults to ViewCompleteness.remote, matching EntityListConfig.

query participates in the memo key by identity, not by value: pass a const ListQuery(...) or hold it in state. A ListQuery rebuilt inline on every render would re-key the family on every render.

Implementation

AsyncValue<EntityListSnapshot<T>> useEntityList<T extends Object>(
  WidgetRef ref, {
  required String type,
  required String queryKey,
  required EntityDecoder<T> fromGraph,
  EntityEncoder<T>? toGraph,
  ListQuery query = const ListQuery(),
  ViewCompleteness completeness = ViewCompleteness.remote,
  bool enabled = true,
  bool subscribe = true,
}) {
  final provider = useMemoized(
    () => entityListProvider<T>(
      type: type,
      queryKey: queryKey,
      fromGraph: fromGraph,
      toGraph: toGraph,
      query: query,
      completeness: completeness,
      enabled: enabled,
      subscribe: subscribe,
    ),
    [type, queryKey, query, completeness, enabled, subscribe],
  );

  return ref.watch(provider);
}