CombineQueryResultList<T> extension Combining results

combine over a list of results of one type — a QueriesObserver's results, say, one per item of a dynamic list — by the same rules as a record of them, and combineWith for that list plus one more source of another type.

final details = itemResults.combineWith(
  listResult,
  (items, list) => Page(title: list.title, items: items),
);
on

Methods

combine<R>(R combiner(List<T> values), {CombineMemo<R>? memo, List<Object?>? keys}) → CombinedResult<R>

Available on List<QueryResult<T>>, provided by the CombineQueryResultList extension

What the list amounts to together — see CombinedResult for the rules: a source that failed with nothing to show wins, otherwise one without data makes it pending, otherwise combiner gets every value in order. An empty list is data. With a memo, combiner must be a function of the sources and keys alone — see CombineMemo.
combineWith<A, R>(QueryResult<A> other, R combiner(List<T> values, A other), {CombineMemo<R>? memo, List<Object?>? keys}) → CombinedResult<R>

Available on List<QueryResult<T>>, provided by the CombineQueryResultList extension

This list and one more source of another type, as one combination — the query a dynamic set of queries was derived from, say: the details of each item and the query that listed the items.