toggleAttachment method

void toggleAttachment(
  1. Attachment attachment,
  2. bool active
)

Implementation

void toggleAttachment(Attachment attachment, bool active) {
  attachments[attachments.indexOf(attachment)].active = active;
  attachments.refresh();
  allAttachmentsDisabled.value = !attachments.any(
    (Attachment attachment) => attachment.active,
  );
  update();
}