RenderSliverClipRRect constructor

RenderSliverClipRRect({
  1. RenderSliver? child,
  2. BorderRadius borderRadius = BorderRadius.zero,
  3. CustomClipper<RRect>? clipper,
  4. Clip clipBehavior = Clip.antiAlias,
})

Creates a rounded-rectangular clip.

The borderRadius defaults to BorderRadius.zero, i.e. a rectangle with right-angled corners.

If clipper is non-null, then borderRadius is ignored.

The clipBehavior argument must not be null or Clip.none.

Implementation

RenderSliverClipRRect({
  RenderSliver? child,
  BorderRadius borderRadius = BorderRadius.zero,
  CustomClipper<RRect>? clipper,
  Clip clipBehavior = Clip.antiAlias,
})  : assert(clipBehavior != null),
      assert(clipBehavior != Clip.none),
      _borderRadius = borderRadius,
      super(child: child, clipper: clipper, clipBehavior: clipBehavior) {
  // `_borderRadius` has a non-nullable return type, but might be null when
  // running with weak checking, so we need to null check it anyway (and
  // ignore the warning that the null-handling logic is dead code).
  assert(_borderRadius != null || clipper != null); // ignore: dead_code
}