incrediblezayed / file_saver

A simple flutter plugin for saving files in all platforms
https://pub.dev/packages/file_saver
BSD 3-Clause "New" or "Revised" License
75 stars 101 forks source link

Handling Api Error status in LinkDetails #82

Closed tusharbhambere closed 7 months ago

tusharbhambere commented 11 months ago

Description:- In LinkDetail passing url which getting 404 how we can handle this?

String path2 = await FileSaver.instance.saveFile(
        name: '${tCcll}_$valueType.pdf',
        link: LinkDetails(
          link: url,
        ),
        mimeType: MimeType.pdf,
      );

Currently its return path=> /storage/emulated/0/Android/data/**.com/files/NS2000054_Quotation.pdf empty pdf saved

*Requirement Need to handle All Error status code in LinkDetails so pdf will not save and throw error

incrediblezayed commented 11 months ago

Is it possible for you to handle and create PR? I'm a bit busy with stuff so... @tusharbhambere

incrediblezayed commented 7 months ago

Just add a try catch block with the method call, throwing the exception directly back to the caller instead of handling locally, you'll find your issues