RadioGroupController<T> class

Holds the value of the selected button so parent widgets can know what is selected and also allows parent widgets to set a new selected value.

This sample shows how to retrieve the value of the selected button.

// First initialize everything
RadioGroupController myController = RadioGroupController();
List<String> items = ["Choice1", "Choice2", "Choice3"];
RadioGroup(
  controller: myController,
  values: items,
  onChanged: (value) {
    liveChangeHere();
  },
  orientation: Horizontal,
)

// This code programmatically sets the last radio button as "selected".
myController.value = items.last;

// This code retrieves the value of the selected button.
String selectedValue = myController.value as String;

Constructors

RadioGroupController()

Properties

hashCode int
The hash code for this object.
no setterinherited
myRadioGroupKey GlobalKey<RadioGroupState<T>>?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedIndex int
Returns the index of the selected item in this controller's radio group.
no setter
value ↔ T?
Returns the value of the selected item in this controller's radio group.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
selectAt(int index) → void
Sets the value of the selected item in this controller's radio group to the value of the element at index in the radio group's value list.
toString() String
A string representation of this object.
inherited

Operators

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