RenderManager class Core Rendering

Manages the rendering lifecycle of components onto a CanvasBuffer.

Tracks which ComponentInstances need to be redrawn (dirty components), handles clearing and redrawing their areas, and manages cursor position updates on the terminal screen.

Coordinates redraw requests efficiently by only rendering components marked as dirty, reducing unnecessary redraws.

Example

final buffer = CanvasBuffer(width: 80, height: 24);
final renderManager = RenderManager(buffer: buffer);

// Mark a component as dirty to trigger redraw
renderManager.markDirty(componentInstance);

// Request redraw of all dirty components
renderManager.requestRedraw();

// Move the cursor to position (10, 5)
renderManager.requestCursorMove(10, 5);
renderManager.render();

See Also

Constructors

RenderManager.new({required CanvasBuffer buffer})
Creates a RenderManager for the given buffer.

Properties

buffer CanvasBuffer
The canvas buffer onto which components are drawn.
final
hasDirtyComponents bool
Whether there are any dirty components queued for redraw.
no setter
hashCode int
The hash code for this object.
no setterinherited
needsRecompute bool
Indicates if a full recompute of layout and rendering is needed.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Clears the list of dirty components, effectively cancelling redraw requests.
markDirty(ComponentInstance comp) → void
Marks the given comp as dirty, scheduling it for redraw.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recalculateScreen() → void
Placeholder to recalculate screen layout or state if needed.
render() → void
Renders the buffer to the terminal and moves/shows the cursor if requested.
requestCursorMove(int x, int y) → void
Requests the cursor be moved to coordinates (x, y) on next render.
requestRecompute(Rect bounds) → void
Requests a full recompute/redraw of the screen inside bounds.
requestRedraw() → void
Requests a redraw of all dirty components.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited