From be54f4e61053e1322ef230edb2d1595c84571a27 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 24 Jan 2022 15:17:50 +0530 Subject: [PATCH] fix(ui): fix cast error while compressing video. Signed-off-by: xsahil03x --- packages/stream_chat_flutter/lib/src/message_input.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index de2b9d09..a43359ee 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -1129,13 +1129,14 @@ class MessageInputState extends State { if (file.size! > widget.maxAttachmentSize) { if (medium.type == AssetType.video && file.path != null) { - final mediaInfo = await (VideoService.compressVideo( + final mediaInfo = await VideoService.compressVideo( file.path!, frameRate: widget.compressedVideoFrameRate, quality: widget.compressedVideoQuality, - ) as FutureOr); + ); - if (mediaInfo.filesize! > widget.maxAttachmentSize) { + if (mediaInfo == null || + mediaInfo.filesize! > widget.maxAttachmentSize) { _showErrorAlert( context.translations.fileTooLargeAfterCompressionError( widget.maxAttachmentSize / (1024 * 1024),