1. override
Shader createShader(Rect rect)

Creates a Shader for this gradient to fill the given rect.

Source

@override
Shader createShader(Rect rect) {
  return new ui.Gradient.linear(
    <Point>[begin.withinRect(rect), end.withinRect(rect)],
    colors, stops, tileMode
  );
}