debugDoingBuild property
Whether the widget is currently updating the widget or render tree.
For StatefulWidgets and StatelessWidgets this flag is true while their respective build methods are executing. RenderObjectWidgets set this to true while creating or configuring their associated RenderObjects. Other Widget types may set this to true for conceptually similar phases of their lifecycle.
When this is true, it is safe for widget to establish a dependency to an InheritedWidget by calling dependOnInheritedElement or dependOnInheritedWidgetOfExactType.
Accessing this flag in release mode is not valid.
Implementation
bool get debugDoingBuild;