loadMore method
Fetches the next page of items.
Implementation
Future<void> loadMore() async {
if (_isLoading || !_hasMore) return;
_isLoading = true;
_error = null;
notifyListeners();
try {
final result = await onFetch(_currentPage);
items.addAll(result.items);
_hasMore = result.hasMore;
if (_hasMore) {
_currentPage++;
}
_error = null;
} catch (e) {
_error = e;
} finally {
_isLoading = false;
notifyListeners();
}
}