ListFormat enum
Shapes how list/array keys are written during query-string encoding.
ListFormat does not decide how values are joined (that is handled by
the encoder). Instead, each case exposes a small generator that
determines the key path used for each element in a list under a given
prefix.
Examples below assume a list under key foo with values [123, 456, 789]:
- ListFormat.brackets →
foo[]=123&foo[]=456&foo[]=789 - ListFormat.comma →
foo=123,456,789(single key; values comma-joined) - ListFormat.repeat →
foo=123&foo=456&foo=789(repeat the key) - ListFormat.indices →
foo[0]=123&foo[1]=456&foo[2]=789
The encoder passes prefix as the current key (e.g. "foo"). For
ListFormat.indices, it also supplies key as the index ("0",
"1", ...). Other formats ignore key.
This mirrors the list formatting strategies used by other qs ports and the
original Node implementation.
Values
- brackets → const ListFormat
-
Use brackets with no index for each element key, e.g.
foo[]=123&foo[]=456&foo[]=789.const ListFormat(_brackets) - comma → const ListFormat
-
Keep the key as-is and rely on the encoder to comma-join the values into a single assignment, e.g.
foo=123,456,789.const ListFormat(_comma) - repeat → const ListFormat
-
Repeat the same key for each element, e.g.
foo=123&foo=456&foo=789.const ListFormat(_repeat) - indices → const ListFormat
-
Write a numeric index inside brackets, e.g.
foo[0]=123&foo[1]=456&foo[2]=789.const ListFormat(_indices)
Properties
- generator → ListFormatGenerator
-
Returns a function that transforms a container
prefix(e.g."foo") and an optional elementkeyinto the key path for a single list item.final - hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - 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.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
ListFormat> - A constant List of the values in this enum, in order of their declaration.