diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 580a4f17..4e30afe1 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -659,7 +659,7 @@ class MessageInputState extends State { Widget _buildFilePickerSection() { var _attachmentContainsFile = - _attachments.any((element) => element.attachment.type == 'file'); + _attachments.any((element) => element?.attachment?.type == 'file'); Color _getIconColor(int index) { switch (index) { @@ -924,7 +924,7 @@ class MessageInputState extends State { ..file = file ..attachment = Attachment( localUri: file.path != null ? Uri.parse(file.path) : null, - type: medium.type == AssetType.image ? 'image' : 'video', + type: medium?.type == AssetType.image ? 'image' : 'video', ); });