SliverGeometry constructor Null safety

const SliverGeometry(
  1. {double scrollExtent = 0.0,
  2. double paintExtent = 0.0,
  3. double paintOrigin = 0.0,
  4. double? layoutExtent,
  5. double maxPaintExtent = 0.0,
  6. double maxScrollObstructionExtent = 0.0,
  7. double? hitTestExtent,
  8. bool? visible,
  9. bool hasVisualOverflow = false,
  10. double? scrollOffsetCorrection,
  11. double? cacheExtent}
)

Creates an object that describes the amount of space occupied by a sliver.

If the layoutExtent argument is null, layoutExtent defaults to the paintExtent. If the hitTestExtent argument is null, hitTestExtent defaults to the paintExtent. If visible is null, visible defaults to whether paintExtent is greater than zero.

The other arguments must not be null.

Implementation

const SliverGeometry({
  this.scrollExtent = 0.0,
  this.paintExtent = 0.0,
  this.paintOrigin = 0.0,
  double? layoutExtent,
  this.maxPaintExtent = 0.0,
  this.maxScrollObstructionExtent = 0.0,
  double? hitTestExtent,
  bool? visible,
  this.hasVisualOverflow = false,
  this.scrollOffsetCorrection,
  double? cacheExtent,
}) : assert(scrollExtent != null),
     assert(paintExtent != null),
     assert(paintOrigin != null),
     assert(maxPaintExtent != null),
     assert(hasVisualOverflow != null),
     assert(scrollOffsetCorrection != 0.0),
     layoutExtent = layoutExtent ?? paintExtent,
     hitTestExtent = hitTestExtent ?? paintExtent,
     cacheExtent = cacheExtent ?? layoutExtent ?? paintExtent,
     visible = visible ?? paintExtent > 0.0;