getAlphaFromOpacity method Null safety

int getAlphaFromOpacity(
  1. double opacity
)

Returns an alpha value representative of the provided opacity value.

The opacity value may not be null.

Implementation

static int getAlphaFromOpacity(double opacity) {
  assert(opacity != null);
  return (opacity.clamp(0.0, 1.0) * 255).round();
}