resolveModifierSpecs function
Implementation
Set<WidgetModifierSpec> resolveModifierSpecs(
List<Type> orderOfModifiers,
MixData mix,
) {
final modifiers = mix.whereType<WidgetModifierAttribute>();
if (modifiers.isEmpty) return {};
final modifierMap = AttributeMap<WidgetModifierAttribute>(modifiers).toMap();
final listOfModifiers = {
// Prioritize the order of modifiers provided by the user.
...orderOfModifiers,
// Add the default order of modifiers.
..._defaultOrder,
// Add any remaining modifiers that were not included in the order.
...modifierMap.keys,
}.toList().reversed;
final specs = <WidgetModifierSpec>[];
for (final modifierType in listOfModifiers) {
// Resolve the modifier and add it to the list of specs.
final modifier = modifierMap.remove(modifierType);
if (modifier == null) continue;
specs.add(modifier.resolve(mix) as WidgetModifierSpec);
}
return specs.toSet();
}