getAllBreakpoints static method

List<RespBreakpoint> getAllBreakpoints(
  1. BuildContext context
)

Get the breakpoints after checking if the user has set any overrides to the breakpoints. The output will contain the custom override set by the user

The result breakpoints will be sorted based value of the breakpoint

context The build context used to get the inherited widgets with the breakpoint overrides

Implementation

static List<RespBreakpoint> getAllBreakpoints(BuildContext context) {
  /// Check if overrides available
  final override =
      context.dependOnInheritedWidgetOfExactType<RespBreakpointsOverride>();

  if (override != null) {
    /// Get the override data and create the final breakpoints list and return it
    if (override.clearDefaultBreakpoints) {
      return _customBreakpointsWithoutDefaults(override.breakpoints);
    } else {
      return _customBreakpoints(override.breakpoints);
    }
  } else {
    /// No overrides set, so return the default breakpoints
    return _defaultBreakpoints;
  }
}