removeAttachment method

Future<void> removeAttachment(
  1. Attachment attachment
)

Removes the specified attachment from the message.

Implementation

Future<void> removeAttachment(Attachment attachment) async {
  final file = attachment.file;
  final uploadState = attachment.uploadState;

  if (file == null || uploadState.isSuccess || isWeb) {
    value = [...value]..remove(attachment);
    return;
  }

  // Remove the cached attachment file.
  await _removeFromCache(file);

  value = [...value]..remove(attachment);
}