update method
void
update()
Updates the screen size and breakpoint based on the current device's metrics (physical size and pixel ratio). It calculates the screen width and height in logical pixels and determines the appropriate breakpoint.
Implementation
void update() {
FlutterView view = PlatformDispatcher.instance.views.first;
physicalWidth = view.physicalSize.width;
physicalHeight = view.physicalSize.height;
devicePixelRatio = view.devicePixelRatio;
screenWidth = physicalWidth / devicePixelRatio;
screenHeight = physicalHeight / devicePixelRatio;
breakpoint = Breakpoint.xs;
for (var b in Breakpoint.values) {
if (screenWidth >= b.toSize) breakpoint = b;
}
notifyListeners();
}