withOpacity static method

Color? withOpacity(
  1. Color? color,
  2. double? opacity
)

Returns a new color that matches this color with the alpha channel replaced with the given opacity (which ranges from 0.0 to 1.0).

Implementation

static Color? withOpacity(Color? color, double? opacity) {
  return opacity != null ? color?.withOpacity(opacity) : color;
}