1

I'm making my portfolio website on flutter i want that if someone click on download cv button,it download on his device.CV is place in the assets folder.

downloadFile(url) {
    AnchorElement anchorElement =
        AnchorElement(href: url);
    anchorElement.download = "CV";
    anchorElement.click();
  }

TextButton(
                    onPressed: () =>
                        downloadFile("/assets/files/Hassan_Naveed_CV.pdf"),
                    child: FittedBox(
                      child: Row(
                        children: [
                          Text(
                            "Download CV",
                            style: TextStyle(
                                color: Theme.of(context)
                                    .textTheme
                                    .bodyText1!
                                    .color),
                          ),
                          const SizedBox(
                            width: defaultPadding / 2,
                          ),
                          const Icon(Icons.download, color: Color(0xFF8B8B8D))
                        ],
                      ),
                    )),

enter image description here

when i click on the download button ,it shows download failed

enter image description here

  • this is my portfolio website if someone visit my website and want to download my CV then he can click on the button and my cv download – Hassan Naveed Sep 26 '22 at 13:32

0 Answers0