onSelect property
Callback triggered when one or more options are selected.
choiceList
is the list of selected items.isFromDefaultData
indicates whether the selection was derived from defaultData.
This value will be true
when:
- The selection is initialized using defaultData.
- defaultData is updated dynamically at runtime from an external state source.
It will be false
when the selection is made directly by the user (e.g., tapping an option).
This flag helps distinguish between automatic selections (driven by logic or external state) and manual selections performed by the user.
Example usage:
onSelect: (choiceList, isFromDefaultData) {
if (!isFromDefaultData) {
// Handle selections made manually by the user.
handleUserSelection(choiceList);
} else {
// Apply logic for selections coming from defaultData.
updateFromExternalState(choiceList);
}
}
Implementation
final void Function(List<Choice<T>> choiceList, bool isFromDefaultData)
onSelect;