copyWith method Null safety

MediaQueryData copyWith(
  1. {Size? size,
  2. double? devicePixelRatio,
  3. double? textScaleFactor,
  4. Brightness? platformBrightness,
  5. EdgeInsets? padding,
  6. EdgeInsets? viewPadding,
  7. EdgeInsets? viewInsets,
  8. EdgeInsets? systemGestureInsets,
  9. bool? alwaysUse24HourFormat,
  10. bool? highContrast,
  11. bool? disableAnimations,
  12. bool? invertColors,
  13. bool? accessibleNavigation,
  14. bool? boldText,
  15. NavigationMode? navigationMode}
)

Creates a copy of this media query data but with the given fields replaced with the new values.

Implementation

MediaQueryData copyWith({
  Size? size,
  double? devicePixelRatio,
  double? textScaleFactor,
  Brightness? platformBrightness,
  EdgeInsets? padding,
  EdgeInsets? viewPadding,
  EdgeInsets? viewInsets,
  EdgeInsets? systemGestureInsets,
  bool? alwaysUse24HourFormat,
  bool? highContrast,
  bool? disableAnimations,
  bool? invertColors,
  bool? accessibleNavigation,
  bool? boldText,
  NavigationMode? navigationMode,
}) {
  return MediaQueryData(
    size: size ?? this.size,
    devicePixelRatio: devicePixelRatio ?? this.devicePixelRatio,
    textScaleFactor: textScaleFactor ?? this.textScaleFactor,
    platformBrightness: platformBrightness ?? this.platformBrightness,
    padding: padding ?? this.padding,
    viewPadding: viewPadding ?? this.viewPadding,
    viewInsets: viewInsets ?? this.viewInsets,
    systemGestureInsets: systemGestureInsets ?? this.systemGestureInsets,
    alwaysUse24HourFormat: alwaysUse24HourFormat ?? this.alwaysUse24HourFormat,
    invertColors: invertColors ?? this.invertColors,
    highContrast: highContrast ?? this.highContrast,
    disableAnimations: disableAnimations ?? this.disableAnimations,
    accessibleNavigation: accessibleNavigation ?? this.accessibleNavigation,
    boldText: boldText ?? this.boldText,
    navigationMode: navigationMode ?? this.navigationMode,
  );
}