FormOption class
Represents a single option item for form components like dropdowns, radios, and chips.
FormOption encapsulates a key-value pair where value is the actual data stored/returned and label is the human-readable text displayed to users.
Example usage:
final option = FormOption(value: 'us', label: 'United States');
print(option.label); // United States
print(option.value); // us
Constructors
- FormOption({required String value, required String label, String? description})
-
Creates a FormOption with the specified value and label.
const
-
FormOption.fromJson(Map<
String, dynamic> json) -
Creates a FormOption from a JSON map.
factory
Properties
- description → String?
-
A second line under label, e.g. a plan's price. Radio options show
it.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- label → String
-
The display text shown to users for this option.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → String
-
The underlying data value for this option.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this FormOption to a JSON map representation.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override