dumpWidgetRender function

Future<void> dumpWidgetRender({
  1. dynamic prefix = '',
})

Implementation

Future<void> dumpWidgetRender({prefix = ''}) async {
  Element? widget = _getMainWidget();
  if (widget != null) {
    final widgetRendering = _printWidgetTree(_getMainWidget(), 0);
    logger.i('Widget tree render :\n $widgetRendering');
    final dumpPath =
        _getReportFolderPath(filenamePrefix: prefix, fileExtension: 'txt');
    await dumpPath.writeAsString(widgetRendering.toString());
    currentWorld.reportFilesPath.add(dumpPath.path);
    currentWorld.dumpFileContent = widgetRendering;
  } else {
    logger.e('Widget render dump failed.');
  }
}