setAlpha method

void setAlpha(
  1. int alpha,
  2. {T? paintId}
)

Changes the opacity of the paint.

Implementation

void setAlpha(int alpha, {T? paintId}) {
  if (alpha < 0 || alpha > 255) {
    throw ArgumentError('Alpha needs to be between 0 and 255');
  }

  setColor(getPaint(paintId).color.withAlpha(alpha), paintId: paintId);
}