document_file_save 1.0.3
document_file_save: ^1.0.3

Flutter Android iOS

Save bytes data into Download folder (Android), or show save dialog (iOS).

document_file_save #

Save bytes data into Download folder (Android), or show save dialog (iOS). You can save any file types (Ex. .txt, .png, .jpg, .pdf, etc)

Install plugin #

add this line into pubspec.yaml

document_file_save: ^1.0.2

Permission #

Android #

if your project set android target >= Android Q, you don't have to add any permission. Otherwise, Add the following statement in AndroidManifest.xml:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

iOS #

No permission needed.

Function description #

// call function 'saveFile' if you 1 file to save.
void saveFile(Uint8List data, String fileName, String mimeType)

// call function 'saveMultipleFiles' if you have mutiple files to save. iOS will show save dialog only once
void saveMultipleFiles(List<Uint8List> dataList, List<String> fileNameList, List<String> mimeTypeList)

Example usage #

import 'package:document_file_save/document_file_save.dart';

//Save multiple files
List<int> textBytes = utf8.encode("Some data");
List<int> textBytes2 = utf8.encode("Another data");
DocumentFileSave.saveMultipleFiles([textBytes, textBytes2], ["text1.txt", "text2.txt"], ["text/plain", "text/plain"]);

//Save single text file
DocumentFileSave.saveFile(textBytes, "my_sample_file.txt", "text/plain");

//Save single pdf file
DocumentFileSave.saveFile(pdfBytes, "my_sample_file.pdf", "appliation/pdf");

//Save single image file
DocumentFileSave.saveFile(imageJPGBytes, "my_sample_file.jpg", "image/jpeg");
1
likes
80
pub points
25%
popularity

Save bytes data into Download folder (Android), or show save dialog (iOS).

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

piyapan039285@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on document_file_save