ControlledMultipleAnswer<T> constructor

const ControlledMultipleAnswer<T>({
  1. Key? key,
  2. MultipleAnswerController<T>? controller,
  3. ValueChanged<Iterable<T>?>? onChanged,
  4. Iterable<T>? initialValue,
  5. bool enabled = true,
  6. bool? allowUnselect,
  7. required Widget child,
})

Creates a ControlledMultipleAnswer.

Either controller or initialValue should be provided to establish the initial selection state. The child should contain choice items that integrate with the multiple selection system.

Parameters:

  • controller (MultipleAnswerController
  • initialValue (Iterable
  • onChanged (ValueChanged<Iterable
  • enabled (bool, default: true): Whether selections can be modified
  • allowUnselect (bool?, optional): Whether items can be deselected by re-selection
  • child (Widget, required): Container with selectable choice items

Example:

ControlledMultipleAnswer<int>(
  initialValue: [1, 3],
  allowUnselect: true,
  onChanged: (values) => print('Selected: $values'),
  child: ChoiceList(items: [1, 2, 3, 4, 5]),
);

Implementation

const ControlledMultipleAnswer({
  super.key,
  this.controller,
  this.onChanged,
  this.initialValue,
  this.enabled = true,
  this.allowUnselect,
  required this.child,
});