priority property

  1. @override
VariantPriority priority
override

This is the priority at which the variants are applied. In the case of some context variants that are due to widget interactivity, they should be applied at a higher priority than media query variants, for example.

Implementation

@override
VariantPriority get priority {
  final priorities =
      variants.whereType<ContextVariant>().map((e) => e.priority).toList();

  // Return normal priority if no priorities are found
  if (priorities.isEmpty) {
    return VariantPriority.normal;
  }

  // get highest priority
  return priorities.reduce(
    (value, element) => value.value > element.value ? value : element,
  );
}