JayTWWM / Share-Files-And-Screenshot-Widgets-Flutter

This pub lets you share any kind of files (csv, mp4, png etc), take screenshot of the widgets you want and return as Image and share them directly as well in the form of an image.
Other
24 stars 14 forks source link

csv... how? #23

Open Lenzeg opened 2 years ago

Lenzeg commented 2 years ago

I was happy to see the csv share option, but there is no example for it in the docs. What is the file type? How to export it? ShareFilesAndScreenshotWidgets().shareFile( "Title", "Name.csv", list, "text/csv", text: "This is the caption!");

Thanks!

This is the code i'm trying to get to work:

      final directory = await getApplicationDocumentsDirectory();

      File f = File('${directory.path}/mycsv.csv');

      String csv = const ListToCsvConverter().convert(data);

      await f.writeAsString(csv);

      var file_as_bytes = await f.readAsBytes();

      Uint8List list = file_as_bytes.buffer.asUint8List();

      ShareFilesAndScreenshotWidgets().shareFile(
          "Title", "Name.csv", list, "text/csv",
          text: "This is the caption!");