diff --git a/lib/src/responsive_breakpoints.dart b/lib/src/responsive_breakpoints.dart index 1b0d97a..7e17f98 100644 --- a/lib/src/responsive_breakpoints.dart +++ b/lib/src/responsive_breakpoints.dart @@ -187,11 +187,13 @@ class ResponsiveBreakpointsState extends State /// Set [breakpoints] and [breakpointSegments]. void setBreakpoints() { // Optimization. Only update breakpoints if dimensions have changed. - if ((windowWidth != getWindowWidth()) || - (windowHeight != getWindowHeight()) || + final newWindowWidth = getWindowWidth(); + final newWindowHeight = getWindowHeight(); + if ((windowWidth != newWindowWidth) || + (windowHeight != newWindowHeight) || (windowWidth == 0)) { - windowWidth = getWindowWidth(); - windowHeight = getWindowHeight(); + windowWidth = newWindowWidth; + windowHeight = newWindowHeight; breakpoints.clear(); breakpoints.addAll(getActiveBreakpoints()); breakpoints.sort(ResponsiveUtils.breakpointComparator);