currentBreakpoint property
RespBreakpoint
get
currentBreakpoint
Get the current breakpoint of the device based on the width of the device
Implementation
RespBreakpoint get currentBreakpoint {
final allBreakpoints = RespBreakPointsHelper.getAllBreakpoints(context);
final currentWidth = width;
/// Check if the current width is greater than the breakpoint value
/// in ascending order of the breakpoints to get the current breakpoint
for (final breakpoint in allBreakpoints.reversed) {
if (currentWidth > breakpoint.value) {
return breakpoint;
}
}
throw Exception(
'''Not able to find the breakpoints matching the device width.
Please check if you have setup your breakpoints properly.''');
}