hasPlatformViewLayers method
Whether the surface's current layer tree contains a platform view.
This is the deterministic signal that hybrid composition is active and
that a toImage capture of the surface boundary would silently drop the
native view content. See cockpitLayerTreeHasPlatformView.
Implementation
bool hasPlatformViewLayers() {
final renderObject = _boundaryKey.currentContext?.findRenderObject();
if (renderObject is! RenderRepaintBoundary) return false;
// `layer` is @protected, but reading a repaint boundary's compositing
// layer is the only production path to its layer tree; `debugLayer`
// returns null outside debug builds. The read is side-effect free.
// ignore: invalid_use_of_protected_member
return cockpitLayerTreeHasPlatformView(renderObject.layer);
}