check method

void check({
  1. int? position,
  2. E? checkItem,
})

选中

Implementation

void check({int? position, E? checkItem}) {
  assert(null != position || null != checkItem);
  if (null != position) {
    assert(position < size);
    checkItem = item(position);
  } else {
    position = indexOfItem(checkItem!);
  }
  if (null != checkItem && !_checks.contains(checkItem)) {
    if (checkType == CheckType.singe) {
      for (var idx = _checks.length - 1; idx >= 0; idx--) {
        uncheck(checkItem: _checks.elementAt(idx));
      }
    }
    _checks.add(checkItem);
    notifyItemChanged(position);
  }
}