useEntityList<T extends Object> function
- 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,
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);
}