reduce7Pods<T, A, B, C, D, E, F, G> function

ChildPod<dynamic, T> reduce7Pods<T, A, B, C, D, E, F, G>(
  1. Pods7<A, B, C, D, E, F, G> instances,
  2. T reducer(
    1. Pods7<A, B, C, D, E, F, G> instances
    ),
  3. (A?, B?, C?, D?, E?, F?, G?) updateParents(
    1. Tuple7<A, B, C, D, E, F, G>,
    2. T childValue
    )?
)

Reduces a tuple of 7 Pod * instancesto a single ChildPod instance via reducer. Optionally provide updateParents to define how parent Pods should be updated when this Pod changes.

Implementation

ChildPod<dynamic, T> reduce7Pods<T, A, B, C, D, E, F, G>(
  Pods7<A, B, C, D, E, F, G> instances,
  T Function(Pods7<A, B, C, D, E, F, G> instances) reducer,
  (A?, B?, C?, D?, E?, F?, G?) Function(
    Tuple7<A, B, C, D, E, F, G>,
    T childValue,
  )? updateParents,
) {
  return ChildPod<dynamic, T>(
    parents: instances.pods.nonNulls.toList(),
    reducer: (_) => reducer(instances),
    updateParents: updateParents != null
        ? (oldParentValues, childValue) {
            final temp = updateParents(
              Tuple7.fromList(oldParentValues),
              childValue,
            );
            return [
              temp.$1,
              temp.$2,
              temp.$3,
              temp.$4,
              temp.$5,
              temp.$6,
              temp.$7,
            ];
          }
        : null,
  );
}