devtools/util/pretty_json library

Functions

boundedPrettyFormatBody(Object? data, {int budget = 2000, int maxListItems = 50, int maxStringLength = 2000}) String
Like prettyFormatBody, but bounds total work via _boundForLogging for an eager caller with no later display step to defer cost to.
prettyFormatBody(Object? data) String
Pretty-prints data as indented JSON for display in the DevTools panel — the common case for an API request/response body. Falls back to a short, readable summary for the two shapes JSON can't represent meaningfully: raw bytes (Uint8List, e.g. a ResponseType.bytes download) and Dio's multipart FormData request bodies. Anything else that isn't valid JSON (plain text, HTML, XML, ...) is shown as-is via Object.toString.
truncateBody(Object? data, int maxLength) Object?
Bounds data before capture, without pretty-printing a Map/List just to measure it — that cost must stay lazy, paid only on open.