Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
to hide user name in chat.
* **Fix**: [182](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/182) Fix
send message not working when user start texting after newLine.
* **Fix**: [191](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/191) Fix
error when using `BuildContext` or `State` extensions when not mounted.

## [1.3.1]

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
4. Make sure your code lints.
5. Push your work back up to your fork.
6. Create the pull request!
7. Include the PR in the CHANGELOG.md
10 changes: 6 additions & 4 deletions lib/src/extensions/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,18 @@ extension ChatViewStateTitleExtension on String? {

/// Extension on State for accessing inherited widget.
extension StatefulWidgetExtension on State {
ChatViewInheritedWidget? get provide => ChatViewInheritedWidget.of(context);
ChatViewInheritedWidget? get provide =>
mounted ? ChatViewInheritedWidget.of(context) : null;

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

/// Extension on State for accessing inherited widget.
extension BuildContextExtension on BuildContext {
ChatViewInheritedWidget? get provide => ChatViewInheritedWidget.of(this);
ChatViewInheritedWidget? get provide =>
mounted ? ChatViewInheritedWidget.of(this) : null;

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