reduce7Pods<T, A, B, C, D, E, F, G> function
Reduces a tuple of 7 Pod * instances
to 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,
);
}