addCompositionCallback method

  1. @override
VoidCallback addCompositionCallback(
  1. CompositionCallback callback
)
override

Adds a CompositionCallback for the current ContainerLayer used by this context.

Composition callbacks are called whenever the layer tree containing the current layer of this painting context gets composited, or when it gets detached and will not be rendered again. This happens regardless of whether the layer is added via retained rendering or not.

Composition callbacks are useful in place of pushing a layer that would otherwise try to observe the layer tree without actually affecting compositing. For example, a composition callback may be used to observe the total transform and clip of the current container layer to determine whether a render object drawn into it is visible or not.

Calling the returned callback will remove callback from the composition callbacks.

See also:

Implementation

@override
VoidCallback addCompositionCallback(CompositionCallback callback) => () {};