updateItemCount method
Implementation
void updateItemCount(int count) {
if (_state.itemCount == count) return;
_state = _state.copyWith(
itemCount: count,
currentIndex: count > 0 ? _state.currentIndex.clamp(0, count - 1) : 0,
);
}
void updateItemCount(int count) {
if (_state.itemCount == count) return;
_state = _state.copyWith(
itemCount: count,
currentIndex: count > 0 ? _state.currentIndex.clamp(0, count - 1) : 0,
);
}