Skip to content

Commit

Permalink
fix: 🐛 empty list exception (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
vatsaltanna authored Aug 12, 2024
1 parent c7de8cb commit 0062027
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [2.1.1]

* **Fix**: [238](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/238) Clear
initial message list - Exception Widget's Ancestor is unsafe

## [2.1.0]

* **Fix**: [226](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/226) Fixed
Expand Down
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 0062027

Please sign in to comment.