Merge pull request #596 from GetStream/fix/590
fix(ui): add null-check in currentUserMember
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
## Upcoming
|
||||
|
||||
🐞 Fixed
|
||||
|
||||
- [#590](https://github.com/GetStream/stream-chat-flutter/issues/590): livestream use case, no members when sending message
|
||||
|
||||
## 2.1.1
|
||||
|
||||
- Updated core dependency
|
||||
|
||||
@@ -965,7 +965,7 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
final currentUser = StreamChat.of(context).currentUser;
|
||||
final members = StreamChannel.of(context).channel.state?.members ?? [];
|
||||
final currentUserMember =
|
||||
members.firstWhere((e) => e.user!.id == currentUser!.id);
|
||||
members.firstWhereOrNull((e) => e.user!.id == currentUser!.id);
|
||||
|
||||
Widget messageWidget = MessageWidget(
|
||||
key: ValueKey<String>('MESSAGE-${message.id}'),
|
||||
@@ -1072,7 +1072,8 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
}
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
showPinButton: widget.pinPermissions.contains(currentUserMember.role),
|
||||
showPinButton: currentUserMember != null &&
|
||||
widget.pinPermissions.contains(currentUserMember.role),
|
||||
);
|
||||
|
||||
if (widget.messageBuilder != null) {
|
||||
|
||||
Reference in New Issue
Block a user