setScissor method
Enables and defines a scissor rectangle for clipping rendering.
When scissor testing is enabled, rendering is confined to the specified rectangular area of the canvas.
x: The x-coordinate of the top-left corner of the scissor box.y: The y-coordinate of the top-left corner of the scissor box.width: The width of the scissor box.height: The height of the scissor box.
Implementation
void setScissor(int x, int y, int width, int height) {
flush();
_renderState
..isScissorEnabled = true
..scissor.set(x, y, width, height);
_renderer.setScissor(x, y, width, height);
}