inspect static method
Recorre el árbol completo y retorna un JSON con todos los widgets que contienen datos relevantes para testing.
El JSON incluye:
timestamp: cuándo se capturówidget_count: cantidad de widgets encontradoswidgets: lista de entradas, cada una contype,depth, y datos según el tipo (value, label, enabled, key, x, y, w, h)
Implementation
static Map<String, dynamic> inspect() {
final root = WidgetsBinding.instance.rootElement;
if (root == null) {
return {
'timestamp': DateTime.now().toUtc().toIso8601String(),
'widget_count': 0,
'widgets': <Map<String, dynamic>>[],
'error': 'rootElement not available',
};
}
final result = <Map<String, dynamic>>[];
_walk(root, 0, result);
return {
'timestamp': DateTime.now().toUtc().toIso8601String(),
'widget_count': result.length,
'widgets': result,
};
}