checkElement method

  1. @override
void checkElement(
  1. Element element
)
override

Check a single element during the unified tree walk.

Called once per element in depth-first order. Detectors inspect the element's widget/render object and accumulate findings. Local nested walks (e.g. counting children) are permitted within this method.

Implementation

@override
void checkElement(Element element) {
  if (_hotInstances.isEmpty) return;
  final hot = _hotInstances[element];
  if (hot == null) return;
  final ro = element.renderObject;
  if (ro == null) return;
  final rect = getGlobalRect(ro);
  if (rect == null) return;
  _highlights.add(
    WidgetHighlight(
      rect: rect,
      renderObject: ro,
      widgetName: hot.type,
      severity: hot.critical ? IssueSeverity.critical : IssueSeverity.warning,
      detectorName: 'Repaint',
      detail: 'likely repaint origin, ${hot.rate.round()}/sec',
    ),
  );
}