RenderOpacity constructor Null safety

RenderOpacity(
  1. {double opacity = 1.0,
  2. bool alwaysIncludeSemantics = false,
  3. RenderBox? child}
)

Creates a partially transparent render object.

The opacity argument must be between 0.0 and 1.0, inclusive.

Implementation

RenderOpacity({
  double opacity = 1.0,
  bool alwaysIncludeSemantics = false,
  RenderBox? child,
}) : assert(opacity != null),
     assert(opacity >= 0.0 && opacity <= 1.0),
     assert(alwaysIncludeSemantics != null),
     _opacity = opacity,
     _alwaysIncludeSemantics = alwaysIncludeSemantics,
     _alpha = ui.Color.getAlphaFromOpacity(opacity),
     super(child);