devtools/util/pretty_json
library
Functions
-
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?
-
Truncates
data's string form to maxLength characters, appending a
marker with the original length, so a single large body can't dominate
the in-memory capture buffers.