setOpacity method
Changes the opacity of the paint.
Implementation
void setOpacity(double opacity, {T? paintId}) {
if (opacity < 0 || opacity > 1) {
throw ArgumentError('Opacity needs to be between 0 and 1');
}
setColor(
getPaint(paintId).color.withValues(alpha: opacity),
paintId: paintId,
);
}