tagOfItem method

dynamic tagOfItem({
  1. required T data,
  2. bool comparator(
    1. T t1,
    2. T t2
    )?,
})

Implementation

tagOfItem({required T data, bool Function(T t1, T t2)? comparator}) {
  int tag = -1;
  if (comparator == null) {
    if (items.value.any((element) => element == data)) {
      tag = items.value.indexOf(data);
      tag += 1;
    }
  } else {
    if (items.value.any((element) => comparator(element, data))) {
      tag = items.value.indexWhere((element) => comparator(element, data));
      tag += 1;
    }
  }

  return tag;
}