Print out widget tree in Flutter test

Viewed 5741

In Flutter, how can I print out the current widget tree in a widget unit test, in order to understand the current state of the UI for debugging?

(For example, in React/Ensyme, I could use debug(). Is there something comparable in Flutter?)

1 Answers

You can use debugDumpApp

This will print the widget tree based on the Diagnosticable interface, which both Widget, RenderObject and Element implements.

Note that for custom made widgets, you'll have to implement a method for their content to display in that tree: debugFillProperties

Related