activeBreakpointIn static method

Breakpoint? activeBreakpointIn(
  1. BuildContext context,
  2. List<Breakpoint> breakpoints
)

Returns the currently active Breakpoint based on the BuildContext and a list of Breakpoints.

Implementation

static Breakpoint? activeBreakpointIn(
    BuildContext context, List<Breakpoint> breakpoints) {
  Breakpoint? currentBreakpoint;

  for (final Breakpoint breakpoint in breakpoints) {
    if (breakpoint.isActive(context)) {
      if (breakpoint.platform != null) {
        // Prioritize platform-specific breakpoints.
        return breakpoint;
      } else {
        // Fallback to non-platform-specific.
        currentBreakpoint = breakpoint;
      }
    }
  }
  return currentBreakpoint;
}