Duplicates enum

Strategy to resolve repeated keys when decoding a query string.

When a query contains the same key more than once (e.g. a=1&a=2&a=3), the decoder must decide whether to keep all values or collapse them into a single value. Duplicates expresses that choice.

Notes:

  • Order is preserved as it appears in the source string.
  • This affects decoding only. The encoder may legitimately produce repeated keys when ListFormat.repeatKey is chosen.

See also: DecodeOptions.duplicates, ListFormat.

Inheritance
Available extensions

Values

combine → const Duplicates

Keep all values as a List, preserving order.

Example: a=1&a=2{ "a": ["1", "2"] }

first → const Duplicates

Keep the first value and ignore the rest.

Example: a=1&a=2{ "a": "1" }

last → const Duplicates

Keep the last value, overwriting earlier ones.

Example: a=1&a=2{ "a": "2" }

Properties

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<Duplicates>
A constant List of the values in this enum, in order of their declaration.