updateItemCount method
Update item count (e.g. when items list changes).
Implementation
void updateItemCount(int count) {
_state = _state.copyWith(
itemCount: count,
currentIndex: count > 0 ? _state.currentIndex.clamp(0, count - 1) : 0,
);
notifyListeners();
}