opaque property Null safety

bool opaque
final

Whether the annotation of this layer should be opaque during an annotation search of type T, preventing siblings visually behind it from being searched.

If opaque is true, and this layer does add its annotation value, then the layer will always be opaque during the search.

If opaque is false, or if this layer does not add its annotation, then the opacity of this layer will be the one returned by the children, meaning that it will be opaque if any child is opaque.

The opaque defaults to false.

The opaque is effectively useless during Layer.find (more specifically, Layer.findAnnotations with onlyFirst: true), since the search process then skips the remaining tree after finding the first annotation.

See also:

  • Layer.findAnnotations, which explains the concept of being opaque to a type of annotation as the return value.
  • HitTestBehavior, which controls similar logic when hit-testing in the render tree.

Implementation

final bool opaque;