Merge branch 'develop' into feat/channel-list-mutable-filters

This commit is contained in:
Sahil Kumar
2022-08-16 15:47:38 +05:30
committed by GitHub
3 changed files with 16 additions and 12 deletions
@@ -4,6 +4,8 @@
- [#1269](https://github.com/GetStream/stream-chat-flutter/issues/1269) - [#1269](https://github.com/GetStream/stream-chat-flutter/issues/1269)
Fix `ChannelListEventHandler` castError at PagedValue.asSuccess. Fix `ChannelListEventHandler` castError at PagedValue.asSuccess.
- [#1241](https://github.com/GetStream/stream-chat-flutter/issues/1241) StreamChannelListView load
more indicator non stop.
✅ Added ✅ Added
@@ -190,13 +190,14 @@ class StreamChannelListController extends PagedValueNotifier<int, Channel> {
return super.refresh(resetValue: resetValue); return super.refresh(resetValue: resetValue);
} }
/// Replaces the previously loaded channels with [channels] and updates /// Replaces the previously loaded channels with the passed [channels].
/// the nextPageKey.
set channels(List<Channel> channels) { set channels(List<Channel> channels) {
value = PagedValue( if (value.isSuccess) {
items: channels, final currentValue = value.asSuccess;
nextPageKey: channels.length, value = currentValue.copyWith(items: channels);
); } else {
value = PagedValue(items: channels);
}
} }
/// Returns/Creates a new Channel and starts watching it. /// Returns/Creates a new Channel and starts watching it.
@@ -153,12 +153,13 @@ class StreamUserListController extends PagedValueNotifier<int, User> {
return super.refresh(resetValue: resetValue); return super.refresh(resetValue: resetValue);
} }
/// Replaces the previously loaded users with [users] and updates /// Replaces the previously loaded users with the passed [users].
/// the nextPageKey.
set users(List<User> users) { set users(List<User> users) {
value = PagedValue( if (value.isSuccess) {
items: users, final currentValue = value.asSuccess;
nextPageKey: users.length, value = currentValue.copyWith(items: users);
); } else {
value = PagedValue(items: users);
}
} }
} }