ResponsiveBuilder.upto constructor Null safety

ResponsiveBuilder.upto(
  1. {WidgetBuilder? xlargeScreen,
  2. WidgetBuilder? largeScreen,
  3. WidgetBuilder? mediumScreen,
  4. WidgetBuilder? smallScreen,
  5. WidgetBuilder? fallback}
)

Implementation

factory ResponsiveBuilder.upto({
  WidgetBuilder? xlargeScreen,
  WidgetBuilder? largeScreen,
  WidgetBuilder? mediumScreen,
  WidgetBuilder? smallScreen,
  // WidgetBuilder? xsmallScreen,
  WidgetBuilder? fallback,
}) {
  WidgetBuilder? _xlargeScreen;
  WidgetBuilder? _largeScreen;
  WidgetBuilder? _mediumScreen;
  WidgetBuilder? _smallScreen;
  WidgetBuilder? _xsmallScreen;
  WidgetBuilder? _fallback = fallback;

  if (xlargeScreen != null) {
    _xsmallScreen = xlargeScreen;
    _smallScreen = xlargeScreen;
    _mediumScreen = xlargeScreen;
    _largeScreen = xlargeScreen;
    _xlargeScreen = xlargeScreen;
  }

  if (largeScreen != null) {
    _xsmallScreen = largeScreen;
    _smallScreen = largeScreen;
    _mediumScreen = largeScreen;
    _largeScreen = largeScreen;
  }

  if (mediumScreen != null) {
    _xsmallScreen = mediumScreen;
    _smallScreen = mediumScreen;
    _mediumScreen = mediumScreen;
  }

  if (smallScreen != null) {
    _xsmallScreen = smallScreen;
    _smallScreen = smallScreen;
  }

  return ResponsiveBuilder(
    xsmallScreen: _xsmallScreen,
    smallScreen: _smallScreen,
    mediumScreen: _mediumScreen,
    largeScreen: _largeScreen,
    xlargeScreen: _xlargeScreen,
    fallback: _fallback,
  );
}