alphaChannel method Null safety

int? alphaChannel(
  1. num? strength
)

Considers the provided number(?) strength.

If strength is between 0..1, the return is an appropriate int for the alpha channel representing that strength as an opacity multiplied by the max channel value 0xFF.

After that check, if strength is an int or double, the return is strength.

If all else fails, the return is null; say, if provided strength itself is also null.

Implementation

static int? alphaChannel(num? strength) => alphaFromStrength(strength);