LogFormatter class

Safely converts log content to text / JSON.

No method throws — a debug tool must never crash the app.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

byteSize(Object? value) → int?
Approximate size of the data in bytes, or null if unknown.
clockTime(DateTime time) → String
14:32:07.482 format.
dateTimeLabel(DateTime time) → String
08.09.2026 14:32:07 format.
encode(Object? value) → String
Compact JSON string.
forJsonView(Object? value) → Object?
Structure for the JSON viewer. Parses strings that contain JSON.
formDataToMap(FormData formData) → Map<String, dynamic>
humanBytes(int bytes) → String
normalizeHeaders(Map<String, dynamic> headers, {bool redact = false}) → Map<String, String>
Normalizes a header map to Map<String, String> (values may be a List).
pretty(Object? value) → String
Indented (readable) JSON string.
sanitize(Object? value, {int depth = 0}) → Object?
Converts any value to a JSON-compatible structure.
tryDecode(String source) → Object?
Decodes a JSON string, otherwise returns null.

Constants

sensitiveHeaders → const Set<String>
Common secret header names. Masking uses Redaction.isSensitive, which covers these and more.