[LLC] Fix upload attachments update method

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-02-17 14:23:07 +05:30
parent beb54babb5
commit 23d762eea7
@@ -229,12 +229,13 @@ class Channel {
client.logger.info('Uploading ${it.id} attachment...'); client.logger.info('Uploading ${it.id} attachment...');
void updateAttachment(Attachment attachment) { void updateAttachment(Attachment attachment) {
message = message.copyWith( final index = message.attachments.indexWhere((it) {
attachments: message.attachments.map((it) { return it.id == attachment.id;
if (it.id != attachment.id) return it; });
return attachment; if (index != -1) {
}).toList(growable: false)); message.attachments[index] = attachment;
state?.addMessage(message); state?.addMessage(message);
}
} }
void onSendProgress(int sent, int total) { void onSendProgress(int sent, int total) {