onGetDocument method
Implementation
void onGetDocument(int? id, String method, Map<String, dynamic>? params) {
if (DebugFlags.enableDevToolsLogs) {
devToolsLogger.finer('[DevTools] DOM.getDocument');
}
// Check if we're using the unified service and if it's in the middle of a context switch
if (devtoolsService is ChromeDevToolsService) {
final unifiedService = ChromeDevToolsService.unifiedService;
if (unifiedService.isContextSwitching) {
// Return null during context switch to clear the DOM panel
sendToFrontend(id, null);
return;
}
}
// Check if controller is attached to Flutter
final ctx = dbgContext;
if (ctx != null && !ctx.isFlutterAttached) {
// Return null if controller is not attached to show empty document
sendToFrontend(id, null);
return;
}
if (document == null || document!.documentElement == null) {
sendToFrontend(id, null);
return;
}
Node root = document!.documentElement!;
InspectorDocument inspectorDoc = InspectorDocument(InspectorNode(root));
sendToFrontend(id, inspectorDoc);
}