copyWith method Null safety

SliverConstraints copyWith(
  1. {AxisDirection? axisDirection,
  2. GrowthDirection? growthDirection,
  3. ScrollDirection? userScrollDirection,
  4. double? scrollOffset,
  5. double? precedingScrollExtent,
  6. double? overlap,
  7. double? remainingPaintExtent,
  8. double? crossAxisExtent,
  9. AxisDirection? crossAxisDirection,
  10. double? viewportMainAxisExtent,
  11. double? remainingCacheExtent,
  12. double? cacheOrigin}
)

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

Implementation

SliverConstraints copyWith({
  AxisDirection? axisDirection,
  GrowthDirection? growthDirection,
  ScrollDirection? userScrollDirection,
  double? scrollOffset,
  double? precedingScrollExtent,
  double? overlap,
  double? remainingPaintExtent,
  double? crossAxisExtent,
  AxisDirection? crossAxisDirection,
  double? viewportMainAxisExtent,
  double? remainingCacheExtent,
  double? cacheOrigin,
}) {
  return SliverConstraints(
    axisDirection: axisDirection ?? this.axisDirection,
    growthDirection: growthDirection ?? this.growthDirection,
    userScrollDirection: userScrollDirection ?? this.userScrollDirection,
    scrollOffset: scrollOffset ?? this.scrollOffset,
    precedingScrollExtent: precedingScrollExtent ?? this.precedingScrollExtent,
    overlap: overlap ?? this.overlap,
    remainingPaintExtent: remainingPaintExtent ?? this.remainingPaintExtent,
    crossAxisExtent: crossAxisExtent ?? this.crossAxisExtent,
    crossAxisDirection: crossAxisDirection ?? this.crossAxisDirection,
    viewportMainAxisExtent: viewportMainAxisExtent ?? this.viewportMainAxisExtent,
    remainingCacheExtent: remainingCacheExtent ?? this.remainingCacheExtent,
    cacheOrigin: cacheOrigin ?? this.cacheOrigin,
  );
}