BoxDecoration constructor Null safety

const BoxDecoration(
  1. {Color? color,
  2. DecorationImage? image,
  3. BoxBorder? border,
  4. BorderRadiusGeometry? borderRadius,
  5. List<BoxShadow>? boxShadow,
  6. Gradient? gradient,
  7. BlendMode? backgroundBlendMode,
  8. BoxShape shape = BoxShape.rectangle}
)

Creates a box decoration.

The shape argument must not be null.

Implementation

const BoxDecoration({
  this.color,
  this.image,
  this.border,
  this.borderRadius,
  this.boxShadow,
  this.gradient,
  this.backgroundBlendMode,
  this.shape = BoxShape.rectangle,
}) : assert(shape != null),
     assert(
       backgroundBlendMode == null || color != null || gradient != null,
       "backgroundBlendMode applies to BoxDecoration's background color or "
       'gradient, but no color or gradient was provided.',
     );