Skip to content

Commit

Permalink
fix: 🐛 empty list exception
Browse files Browse the repository at this point in the history
  • Loading branch information
vatsaltanna committed Aug 11, 2024
1 parent c7de8cb commit a703fd3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/src/extensions/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@ extension ChatViewStateTitleExtension on String? {
/// Extension on State for accessing inherited widget.
extension StatefulWidgetExtension on State {
ChatViewInheritedWidget? get chatViewIW =>
mounted ? ChatViewInheritedWidget.of(context) : null;
context.mounted ? ChatViewInheritedWidget.of(context) : null;

ReplySuggestionsConfig? get suggestionsConfig =>
mounted ? SuggestionsConfigIW.of(context)?.suggestionsConfig : null;
ReplySuggestionsConfig? get suggestionsConfig => context.mounted
? SuggestionsConfigIW.of(context)?.suggestionsConfig
: null;

ConfigurationsInheritedWidget get chatListConfig =>
mounted && ConfigurationsInheritedWidget.of(context) != null
context.mounted && ConfigurationsInheritedWidget.of(context) != null
? ConfigurationsInheritedWidget.of(context)!
: const ConfigurationsInheritedWidget(
chatBackgroundConfig: ChatBackgroundConfiguration(),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widgets/chat_list_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class _ChatListWidgetState extends State<ChatListWidget>

@override
void dispose() {
chatViewIW?.chatController.messageStreamController.close();
chatController.messageStreamController.close();
scrollController.dispose();
_isNextPageLoading.dispose();
super.dispose();
Expand Down

0 comments on commit a703fd3

Please sign in to comment.