responsiveValue<T> method

T? responsiveValue<T>({
  1. T? mobile,
  2. T? tablet,
  3. T? desktop,
  4. T? watch,
})

Return widget according to screen type if the screenType is ScreenType.Desktop and desktop object is null the tablet object will be returned and if tablet object is null the mobile object will be returned and if mobile object is null the watch object will be returned also when it is null.

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;
}