diff --git a/packages/stream_chat/lib/src/api/channel.dart b/packages/stream_chat/lib/src/api/channel.dart index cb3cfe37..69d967fe 100644 --- a/packages/stream_chat/lib/src/api/channel.dart +++ b/packages/stream_chat/lib/src/api/channel.dart @@ -1427,7 +1427,7 @@ class ChannelClientState { /// This flag should be managed by UI sdks. /// When false, any new message (received by WebSocket event /// - [EventType.messageNew]) will not be pushed on to message list. - bool get isUpToDate => _isUpToDateController.value ?? true; + bool get isUpToDate => _isUpToDateController.value; set isUpToDate(bool isUpToDate) => _isUpToDateController.add(isUpToDate); @@ -1528,7 +1528,7 @@ class ChannelClientState { } if (_countMessageAsUnread(message)) { - _unreadCountController.add(_unreadCountController.value! + 1); + _unreadCountController.add(_unreadCountController.value + 1); } })); } @@ -1766,13 +1766,13 @@ class ChannelClientState { a.createdAt.compareTo(b.createdAt); /// The channel state related to this client - ChannelState get _channelState => _channelStateController.value!; + ChannelState get _channelState => _channelStateController.value; /// The channel state related to this client as a stream Stream get channelStateStream => _channelStateController.stream; /// The channel state related to this client - ChannelState get channelState => _channelStateController.value!; + ChannelState get channelState => _channelStateController.value; late BehaviorSubject _channelStateController; final Debounce _debouncedUpdatePersistenceChannelState; @@ -1784,7 +1784,7 @@ class ChannelClientState { /// The channel threads related to this channel Map> get threads => - _threadsController.value!.map((key, value) => MapEntry(key, value)); + _threadsController.value.map((key, value) => MapEntry(key, value)); /// The channel threads related to this channel as a stream Stream>> get threadsStream => @@ -1801,7 +1801,7 @@ class ChannelClientState { } /// Channel related typing users last value - List get typingEvents => _typingEventsController.value!; + List get typingEvents => _typingEventsController.value; /// Channel related typing users stream Stream> get typingEventsStream => _typingEventsController.stream; diff --git a/packages/stream_chat/lib/src/client.dart b/packages/stream_chat/lib/src/client.dart index 3cabe274..b6efb6a5 100644 --- a/packages/stream_chat/lib/src/client.dart +++ b/packages/stream_chat/lib/src/client.dart @@ -1495,7 +1495,7 @@ class ClientState { Stream get userStream => _userController.stream; /// The current user - Map get users => _usersController.value!; + Map get users => _usersController.value; /// The current user as a stream Stream> get usersStream => _usersController.stream; @@ -1517,7 +1517,7 @@ class ClientState { _channelsController.stream; /// The current list of channels in memory - Map get channels => _channelsController.value!; + Map get channels => _channelsController.value; set channels(Map v) { _channelsController.add(v); diff --git a/packages/stream_chat_flutter_core/lib/src/channel_list_core.dart b/packages/stream_chat_flutter_core/lib/src/channel_list_core.dart index a3be273d..dbd57269 100644 --- a/packages/stream_chat_flutter_core/lib/src/channel_list_core.dart +++ b/packages/stream_chat_flutter_core/lib/src/channel_list_core.dart @@ -132,6 +132,8 @@ class ChannelListCoreState extends State { stream: channelsBlocState.channelsStream, builder: (context, snapshot) { if (snapshot.hasError) { + print(snapshot.error); + print(snapshot.stackTrace); return widget.errorBuilder(context, snapshot.error!); } if (!snapshot.hasData) { diff --git a/packages/stream_chat_flutter_core/lib/src/channels_bloc.dart b/packages/stream_chat_flutter_core/lib/src/channels_bloc.dart index d46ee4bd..a3f0b58c 100644 --- a/packages/stream_chat_flutter_core/lib/src/channels_bloc.dart +++ b/packages/stream_chat_flutter_core/lib/src/channels_bloc.dart @@ -71,7 +71,7 @@ class ChannelsBlocState extends State } /// The current channel list - List? get channels => _channelsController.value; + List? get channels => _channelsController.valueOrNull; /// The current channel list as a stream Stream> get channelsStream => _channelsController.stream; @@ -128,7 +128,7 @@ class ChannelsBlocState extends State _channelsController.add(temp); } if (_channelsController.hasValue && - _queryChannelsLoadingController.value!) { + _queryChannelsLoadingController.value) { _queryChannelsLoadingController.sink.add(false); } } diff --git a/packages/stream_chat_flutter_core/lib/src/message_search_bloc.dart b/packages/stream_chat_flutter_core/lib/src/message_search_bloc.dart index 386ba388..70e6df11 100644 --- a/packages/stream_chat_flutter_core/lib/src/message_search_bloc.dart +++ b/packages/stream_chat_flutter_core/lib/src/message_search_bloc.dart @@ -93,8 +93,7 @@ class MessageSearchBlocState extends State final temp = oldMessages + messages.results; _messageResponses.add(temp); } - if (_messageResponses.hasValue && - _queryMessagesLoadingController.value!) { + if (_messageResponses.hasValue && _queryMessagesLoadingController.value) { _queryMessagesLoadingController.add(false); } } catch (e, stk) { diff --git a/packages/stream_chat_flutter_core/lib/src/users_bloc.dart b/packages/stream_chat_flutter_core/lib/src/users_bloc.dart index 57edfecb..0c0d46cd 100644 --- a/packages/stream_chat_flutter_core/lib/src/users_bloc.dart +++ b/packages/stream_chat_flutter_core/lib/src/users_bloc.dart @@ -92,7 +92,7 @@ class UsersBlocState extends State final temp = oldUsers + usersResponse.users; _usersController.add(temp); } - if (_usersController.hasValue && _queryUsersLoadingController.value!) { + if (_usersController.hasValue && _queryUsersLoadingController.value) { _queryUsersLoadingController.add(false); } } catch (e, stk) {