SizeBudgetSanitizer class
Ensures the serialized JSON stays under maxBytes. If the payload exceeds the budget, the sanitizer drops entries heuristically (starting with the largest string/list/map values) until the size fits. You may pin keys that must be retained via pinnedTopLevelKeys.
- Implemented types
- Available extensions
Constructors
-
SizeBudgetSanitizer({required int maxBytes, Set<
String> pinnedTopLevelKeys = const {'exception', 'timestamp', 'fingerprints'}, String overflowMarker = '<redacted:size>'}) -
Creates a size budget sanitizer that trims payloads to
maxBytes.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxBytes → int
-
Maximum payload size in bytes.
final
- overflowMarker → String
-
Marker stored when entries are dropped due to size constraints.
final
-
pinnedTopLevelKeys
→ Set<
String> -
Keys that should be retained even when trimming for size.
final
- 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
-
sanitize(
Map< String, dynamic> data) → Map<String, dynamic> -
Returns a new sanitized map. The input is never mutated.
override
-
sanitizeEvent(
ReportEvent event) → ReportEvent -
Available on Sanitizer, provided by the ReportEventSanitizer extension
Returns a copy ofeventwith the sanitized payload embedded. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited