decide method
This collection once the roles have chosen: a contribution with
conditions on what roles chose (Contribution.whenChosen) applies
only if it applies by the roles and each condition holds in an app
with the presentRoles, whose roles made the choices.
Contributions that do not apply are kept, as in collect, so that a
fragment variable that only a brick which the app leaves out reads is
left out with it.
Implementation
Collection decide(Map<Role, Object?> choices, Set<Role> presentRoles) =>
Collection(
List.unmodifiable([
for (final collected in all)
if (collected.applies &&
!collected.contribution.whenChosen.every(
(condition) => condition.holds(
presentRoles: presentRoles,
choices: choices,
),
))
Collected(
collected.contribution,
collected.origin,
applies: false,
fromHook: collected.fromHook,
)
else
collected,
]),
issues: issues,
);