getMatchedConfig method

LayoutMatchConfig? getMatchedConfig(
  1. ActiveLayoutInfo layoutInfo
)

Finds the best matching LayoutMatchConfig for the given layoutInfo. Returns null if no configuration matches and no default builder is specified.

Implementation

LayoutMatchConfig? getMatchedConfig(ActiveLayoutInfo layoutInfo) {
  LayoutMatchConfig? bestMatch;
  for (final config in configs) {
    if (config.matches(
      activeBreakpointId: layoutInfo.activeBreakpointId,
      currentOrientation: layoutInfo.orientation,
      currentPlatform: layoutInfo.adaptivePlatform,
      currentFormFactor: layoutInfo.formFactor, // Pass formFactor
    )) {
      if (bestMatch == null || config.specificity > bestMatch.specificity) {
        bestMatch = config;
      }
    }
  }
  return bestMatch;
}