copyWith method Null safety

BoxConstraints copyWith(
  1. {double? minWidth,
  2. double? maxWidth,
  3. double? minHeight,
  4. double? maxHeight}
)

Creates a copy of this box constraints but with the given fields replaced with the new values.

Implementation

BoxConstraints copyWith({
  double? minWidth,
  double? maxWidth,
  double? minHeight,
  double? maxHeight,
}) {
  return BoxConstraints(
    minWidth: minWidth ?? this.minWidth,
    maxWidth: maxWidth ?? this.maxWidth,
    minHeight: minHeight ?? this.minHeight,
    maxHeight: maxHeight ?? this.maxHeight,
  );
}