checkIsDataOnSelectedList method

bool checkIsDataOnSelectedList(
  1. T data,
  2. List<T> selectedList, {
  3. required bool compareSelectedData(
    1. T,
    2. T
    ),
})

function to check if data in selected list

Implementation

bool checkIsDataOnSelectedList(T data, List<T> selectedList,
    {required bool Function(T, T) compareSelectedData}) {
  if (selectedList.isEmpty) return false;
  return selectedList.any((e) => compareSelectedData(e, data));
}