Merge pull request #1299 from GetStream/fix/channel-list-controller
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
- [#1269](https://github.com/GetStream/stream-chat-flutter/issues/1269)
|
||||
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
|
||||
|
||||
|
||||
@@ -163,13 +163,14 @@ class StreamChannelListController extends PagedValueNotifier<int, Channel> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Replaces the previously loaded channels with [channels] and updates
|
||||
/// the nextPageKey.
|
||||
/// Replaces the previously loaded channels with the passed [channels].
|
||||
set channels(List<Channel> channels) {
|
||||
value = PagedValue(
|
||||
items: channels,
|
||||
nextPageKey: channels.length,
|
||||
);
|
||||
if (value.isSuccess) {
|
||||
final currentValue = value.asSuccess;
|
||||
value = currentValue.copyWith(items: channels);
|
||||
} else {
|
||||
value = PagedValue(items: channels);
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns/Creates a new Channel and starts watching it.
|
||||
|
||||
@@ -153,12 +153,13 @@ class StreamUserListController extends PagedValueNotifier<int, User> {
|
||||
return super.refresh(resetValue: resetValue);
|
||||
}
|
||||
|
||||
/// Replaces the previously loaded users with [users] and updates
|
||||
/// the nextPageKey.
|
||||
/// Replaces the previously loaded users with the passed [users].
|
||||
set users(List<User> users) {
|
||||
value = PagedValue(
|
||||
items: users,
|
||||
nextPageKey: users.length,
|
||||
);
|
||||
if (value.isSuccess) {
|
||||
final currentValue = value.asSuccess;
|
||||
value = currentValue.copyWith(items: users);
|
||||
} else {
|
||||
value = PagedValue(items: users);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user