isSelectedIn method

bool isSelectedIn(
  1. List<Choice<T>> selectedChoice
)

Whether this choice is currently selected within selectedChoice.

Mirrors the original _isSelected predicate from StandardMultiSelectField, comparing by Choice.key.

Implementation

bool isSelectedIn(List<Choice<T>> selectedChoice) {
  if (isGroupingTitle) return false;
  return selectedChoice
      .where(
        (element) => (key != null || key!.isNotEmpty) && element.key == key,
      )
      .isNotEmpty;
}