resolveChipDisplayLabel<T> method
Resolves the display label shown on the chip.
- No selection → original
label - Single selection → the selected item's value
- Multi selection → "
label(count)"
Implementation
String resolveChipDisplayLabel<T>({
required String label,
required List<Choice<T>> selectedChoices,
required bool singleSelection,
required bool hasData,
}) {
if (selectedChoices.isEmpty || !hasData) return label;
return singleSelection
? selectedChoices.first.value
: '$label (${selectedChoices.length})';
}