EncodeOptions class final

Options that configure the output of QS.encode.

Mixed-in types

Constructors

EncodeOptions({Encoder? encoder, DateSerializer? serializeDate, ListFormat? listFormat, @Deprecated('Use listFormat instead') bool? indices, bool? allowDots, bool addQueryPrefix = false, bool allowEmptyLists = false, Encoding charset = utf8, bool charsetSentinel = false, String delimiter = '&', num depth = double.infinity, bool encode = true, bool encodeDotInKeys = false, bool encodeValuesOnly = false, Format format = Format.rfc3986, dynamic filter, bool skipNulls = false, bool strictNullHandling = false, bool? commaRoundTrip, bool commaCompactNulls = false, Sorter? sort})
const

Properties

addQueryPrefix → bool
Set to true to add a question mark ? prefix to the encoded output.
final
allowDots → bool
Set to true to use dot Map notation in the encoded output.
final
allowEmptyLists → bool
Set to true to allow empty Lists in the encoded output.
final
charset → Encoding
The character encoding to use.
final
charsetSentinel → bool
Set to true to announce the character by including an utf8=✓ parameter with the proper encoding of the checkmark, similar to what Ruby on Rails and others do when submitting forms.
final
commaCompactNulls → bool
When listFormat is ListFormat.comma, drop null items before joining.
final
commaRoundTrip → bool?
When listFormat is set to ListFormat.comma, you can also set commaRoundTrip option to true or false, to append [] on single-item Lists, so that they can round trip through a parse.
final
delimiter → String
The delimiter to use when joining key-value pairs in the encoded output.
final
depth → num
Maximum encode nesting depth, with the top-level value at depth 0. Exceeding this limit throws RangeError. Defaults to unbounded.
final
encode → bool
Set to false to disable encoding.
final
encodeDotInKeys → bool
Encode Map keys using dot notation by setting encodeDotInKeys to true:
final
encodeValuesOnly → bool
Encoding can be disabled for keys by setting the encodeValuesOnly to true
final
filter → dynamic
Use the filter option to restrict which keys will be included in the encoded output. If you pass a Function, it will be called for each key to obtain the replacement value. If you pass a List, it will be used to select properties and List indices to be encoded.
final
format → Format
The encoding format to use. The default format is Format.rfc3986 which encodes ' ' to %20 which is backward compatible. You can also set format to Format.rfc1738 which encodes ' ' to +.
final
formatter → Formatter
Convenience getter for accessing the format's Format.formatter
no setter
hashCode → int
The hash code for this object.
no setterinherited
listFormat → ListFormat
The List encoding format to use.
final
props → List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
skipNulls → bool
Set to true to completely skip encoding keys with null values
final
sort → Sorter?
Set a Sorter to affect the order of parameter keys.
final
strictNullHandling → bool
Set to true to distinguish between null values and empty Strings. This way the encoded string null values will have no = sign.
final
stringify → bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

Methods

copyWith({bool? addQueryPrefix, bool? allowDots, bool? allowEmptyLists, ListFormat? listFormat, Encoding? charset, bool? charsetSentinel, String? delimiter, num? depth, bool? encode, bool? encodeDotInKeys, bool? encodeValuesOnly, Format? format, bool? skipNulls, bool? strictNullHandling, bool? commaRoundTrip, bool? commaCompactNulls, Sorter? sort, dynamic filter, DateSerializer? serializeDate, Encoder? encoder}) → EncodeOptions
Returns a new EncodeOptions instance with updated values.
encoder(dynamic value, {Encoding? charset, Format? format}) → String
Encodes a value to a String.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
serializeDate(DateTime date) → String
Serializes a DateTime instance to a String.
toString() → String
A string representation of this object.
override
validate() → void
Validates the encoding options, throwing ArgumentError on invalid values.

Operators

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