ResponsiveBuilder.from constructor Null safety

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

Implementation

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

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

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

  if (mediumScreen != null) {
    _mediumScreen = mediumScreen;
    _largeScreen = mediumScreen;
    _xlargeScreen = mediumScreen;
  }

  if (largeScreen != null) {
    _largeScreen = largeScreen;
    _xlargeScreen = largeScreen;
  }

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