responsiveValue<T> method
T?
responsiveValue<T>({
- T? mobile,
- T? tablet,
- T? desktop,
- T? watch,
Returns a value based on the current screen type.
If the screenType is ScreenType.desktop and desktop is null,
the tablet value will be returned. If tablet is also null,
the mobile value will be returned, and so on.
Implementation
T? responsiveValue<T>({T? mobile, T? tablet, T? desktop, T? watch}) {
if (isDesktop && desktop != null) return desktop;
if (isTablet && tablet != null) return tablet;
if (isPhone && mobile != null) return mobile;
return watch;
}