fix: add null checks to message text
This commit is contained in:
@@ -845,7 +845,7 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
) {
|
||||
final isMyMessage =
|
||||
message.user!.id == StreamChat.of(context).currentUser!.id;
|
||||
final isOnlyEmoji = message.text!.isOnlyEmoji;
|
||||
final isOnlyEmoji = message.text?.isOnlyEmoji ?? false;
|
||||
final currentUser = StreamChat.of(context).currentUser;
|
||||
final members = StreamChannel.of(context).channel.state?.members ?? [];
|
||||
final currentUserMember =
|
||||
|
||||
@@ -1048,7 +1048,7 @@ class _MessageWidgetState extends State<MessageWidget>
|
||||
messageWidget: widget.copyWith(
|
||||
key: const Key('MessageWidget'),
|
||||
message: widget.message.copyWith(
|
||||
text: widget.message.text!.length > 200
|
||||
text: (widget.message.text?.length ?? 0) > 200
|
||||
? '${widget.message.text!.substring(0, 200)}...'
|
||||
: widget.message.text,
|
||||
),
|
||||
@@ -1111,7 +1111,7 @@ class _MessageWidgetState extends State<MessageWidget>
|
||||
messageWidget: widget.copyWith(
|
||||
key: const Key('MessageWidget'),
|
||||
message: widget.message.copyWith(
|
||||
text: widget.message.text!.length > 200
|
||||
text: (widget.message.text?.length ?? 0) > 200
|
||||
? '${widget.message.text!.substring(0, 200)}...'
|
||||
: widget.message.text,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user