render method

  1. @override
  2. @mustCallSuper
void render(
  1. Canvas canvas
)
@mustCallSuper, override

This implementation of render basically calls renderComponent for every component, making sure the canvas is reset for each one.

You can override it further to add more custom behaviour. Beware of however you are rendering components if not using this; you must be careful to save and restore the canvas to avoid components messing up with each other.

Implementation

@override
@mustCallSuper
void render(Canvas canvas) {
  canvas.save();
  components.forEach((comp) => renderComponent(canvas, comp));
  canvas.restore();
}