debugProfileBuildsEnabled top-level property Null safety
read / write
Adds Timeline events for every Widget built.
The timing information this flag exposes is not representative of the actual cost of building, because the overhead of adding timeline events is significant relative to the time each object takes to build. However, it can expose unexpected widget behavior in the timeline.
In debug builds, additional information is included in the trace (such as the properties of widgets being built). Collecting this data is expensive and further makes these traces non-representative of actual performance. This data is omitted in profile builds.
For more information about performance debugging in Flutter, see flutter.dev/docs/perf/rendering.
See also:
- debugPrintRebuildDirtyWidgets, which does something similar but reporting the builds to the console.
- debugProfileLayoutsEnabled, which does something similar for layout, and debugPrintLayouts, its console equivalent.
- debugProfilePaintsEnabled, which does something similar for painting.
- debugProfileBuildsEnabledUserWidgets, which adds events for user-created Widget build times and incurs less overhead.
- debugEnhanceBuildTimelineArguments, which enhances the trace with debugging information related to Widget builds.
Implementation
bool debugProfileBuildsEnabled = false;