Decoder typedef
Decoding options for QS.decode.
This mirrors the behavior of the reference qs library and provides a few
guard rails against untrusted input (parameter count, nesting depth, list
index limits). The defaults aim to be safe and predictable while matching
the semantics used across the ports in this repository.
Highlights
- Dot notation: set
allowDotsto treata.b=clike{a: {b: "c"}}. If you explicitly request dot decoding in keys viadecodeDotInKeys,allowDotsis implied and will be treated astrueunless you explicitly setallowDots: false— which is an invalid combination and will throw at construction time. - Charset handling:
charsetselects UTF‑8 or Latin‑1 decoding. WhencharsetSentinelistrue, a leadingutf8=✓token (in either UTF‑8 or Latin‑1 form) can overridecharsetas a compatibility escape hatch. - Limits:
parameterLimit,depth, andlistLimitare DoS guards. If you want hard failures instead of soft limiting, enablethrowOnLimitExceededand/orstrictDepth. - Duplicates: use
duplicatesto pick a strategy when the same key is present multiple times in the input.
See also: the options types in other ports for parity, and the individual doc comments below for precise semantics. Preferred signature for a custom scalar decoder used by DecodeOptions.
Implementations may choose to ignore charset or kind, but both are
provided to enable key-aware decoding when desired.
Implementation
/// Preferred signature for a custom scalar decoder used by [DecodeOptions].
///
/// Implementations may choose to ignore [charset] or [kind], but both are
/// provided to enable key-aware decoding when desired.
typedef Decoder = dynamic Function(
String? value, {
Encoding? charset,
DecodeKind? kind,
});