Merge pull request #1299 from GetStream/fix/channel-list-controller

This commit is contained in:
Sahil Kumar
2022-08-16 15:32:46 +05:30
committed by GitHub
3 changed files with 16 additions and 12 deletions
@@ -2,6 +2,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.
## 4.4.1 ## 4.4.1
@@ -163,13 +163,14 @@ class StreamChannelListController extends PagedValueNotifier<int, Channel> {
} }
} }
/// 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);
}
} }
} }