shader property
The shader to use when stroking or filling a shape.
When this is null, the color is used instead.
See also:
- Gradient, a shader that paints a color gradient.
- ImageShader, a shader that tiles an Image.
- colorFilter, which overrides shader.
- color, which is used if shader and colorFilter are null.
Implementation
Shader? get shader {
return _objects?[_kShaderIndex] as Shader?;
}
Implementation
set shader(Shader? value) {
assert(() {
assert(
value == null || !value.debugDisposed,
'Attempted to set a disposed shader to $this',
);
return true;
}());
assert(() {
if (value is FragmentShader) {
if (!value._validateSamplers()) {
throw Exception('Invalid FragmentShader ${value._debugName ?? ''}: missing sampler');
}
}
return true;
}());
_ensureObjectsInitialized()[_kShaderIndex] = value;
}