setOpacity method

void setOpacity(
  1. double opacity,
  2. {T? paintId}
)

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.withOpacity(opacity), paintId: paintId);
}