part of '../spotify.dart'; abstract class PaginatedAsyncNotifier> extends AsyncNotifier with SpotifyMixin { Future> fetch(int offset, int limit); Future fetchMore() async { if (state.value == null || !state.value!.hasMore) return; await update( (state) async { final items = await fetch(state.offset + state.limit, state.limit); return state.copyWith( items: [ ...state.items, ...items, ], offset: state.offset + state.limit, ) as T; }, ); } } abstract class FamilyPaginatedAsyncNotifier, A> extends FamilyAsyncNotifier with SpotifyMixin { Future> fetch(A arg, int offset, int limit); Future fetchMore() async { if (state.value == null || !state.value!.hasMore) return; await update( (state) async { final items = await fetch( arg, state.offset + state.limit, state.limit, ); return state.copyWith( items: [ ...state.items, ...items, ], offset: state.offset + state.limit, ) as T; }, ); } }