applyChain method

void applyChain(
  1. void draw(
    1. Canvas
    ),
  2. Canvas canvas
)

Applies this and all subsequent decorators if any.

This method is the main method through which the decorator is applied.

Implementation

void applyChain(void Function(Canvas) draw, Canvas canvas) {
  apply(
    _next == null
        ? draw
        : (nextCanvas) => _next!.applyChain(draw, nextCanvas),
    canvas,
  );
}