The property 'window' can't be unconditionally accessed because the receiver can be 'null'
This error appears on my flutter app after connecting it to the firebase. Not really sure if that has something to do with the cause of the error. here is the code
Size size = WidgetsBinding.instance.window.physicalSize /
WidgetsBinding.instance.window.devicePixelRatio;
///This method is used to set padding/margin (for the left and Right side) & width of the screen or widget according to the Viewport width.
double getHorizontalSize(double px) {
return px * (size.width / 360);
}...