♻️ Rebuilt fetching state machine
This commit is contained in:
@@ -96,13 +96,27 @@ Future<SnActorStatusResponse> publisherActorStatus(
|
||||
final publisherMemberListNotifierProvider = AsyncNotifierProvider.family
|
||||
.autoDispose(PublisherMemberListNotifier.new);
|
||||
|
||||
class PublisherMemberListNotifier extends AsyncNotifier<List<SnPublisherMember>>
|
||||
class PublisherMemberListNotifier
|
||||
extends AsyncNotifier<PaginationState<SnPublisherMember>>
|
||||
with AsyncPaginationController<SnPublisherMember> {
|
||||
static const int pageSize = 20;
|
||||
|
||||
final String arg;
|
||||
PublisherMemberListNotifier(this.arg);
|
||||
|
||||
@override
|
||||
FutureOr<PaginationState<SnPublisherMember>> build() async {
|
||||
final items = await fetch();
|
||||
return PaginationState(
|
||||
items: items,
|
||||
isLoading: false,
|
||||
isReloading: false,
|
||||
totalCount: totalCount,
|
||||
hasMore: hasMore,
|
||||
cursor: cursor,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<SnPublisherMember>> fetch() async {
|
||||
final apiClient = ref.read(apiClientProvider);
|
||||
|
||||
@@ -21,7 +21,7 @@ final pollListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
|
||||
PollListNotifier.new,
|
||||
);
|
||||
|
||||
class PollListNotifier extends AsyncNotifier<List<SnPollWithStats>>
|
||||
class PollListNotifier extends AsyncNotifier<PaginationState<SnPollWithStats>>
|
||||
with AsyncPaginationController<SnPollWithStats> {
|
||||
static const int pageSize = 20;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ final siteListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
|
||||
SiteListNotifier.new,
|
||||
);
|
||||
|
||||
class SiteListNotifier extends AsyncNotifier<List<SnPublicationSite>>
|
||||
class SiteListNotifier extends AsyncNotifier<PaginationState<SnPublicationSite>>
|
||||
with AsyncPaginationController<SnPublicationSite> {
|
||||
static const int pageSize = 20;
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ final stickerPacksProvider = AsyncNotifierProvider.family.autoDispose(
|
||||
StickerPacksNotifier.new,
|
||||
);
|
||||
|
||||
class StickerPacksNotifier extends AsyncNotifier<List<SnStickerPack>>
|
||||
class StickerPacksNotifier extends AsyncNotifier<PaginationState<SnStickerPack>>
|
||||
with AsyncPaginationController<SnStickerPack> {
|
||||
static const int pageSize = 20;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user