搜尋套件、儲存庫與 APP 分類

套件詳情v2.0.0

document_file_save_plus

將位元組資料儲存至下載資料夾(Android),或在iOS上顯示儲存對話方塊。

AndroidiOS
近 30 天下載
4360
喜歡數
55
Pub 分數
130

安裝套件

flutter pub add document_file_save_plus

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter 套件,可在 Android 上將字節資料儲存至裝置的下載資料夾,或在 iOS 上顯示儲存對話方塊。它透過自動處理平台特定行為,簡化跨平台的檔案持久化。適用於需要匯出 PDF、圖片或文件等檔案,卻不需複雜原生程式碼的應用程式。此套件支援直接下載與使用者控制的儲存,確保與現代作業系統限制的相容性。可輕鬆整合至現有工作流程,設定簡單。

適用情境

  • 匯出產生的PDF
  • 儲存影像或音訊檔案
  • 共享應用生成的文件
  • 處理跨平台應用中的檔案匯出
  • 在 iOS 上啟用使用者控制的檔案儲存

主要特色

  • 平台特定的檔案儲存
  • Android 上的自動下載資料夾存取
  • 在 iOS 上儲存對話方塊
  • 簡單的位元組資料輸入
  • 跨平台相容性
  • 所需設定最少

適合對象

  • 需要檔案匯出功能的應用程式
  • 同時針對 Android 和 iOS 的開發者
  • 涉及文件或媒體產生的專案
  • 需要符合 iOS 檔案儲存指南的應用程式
  • 避免原生平台程式碼的團隊

使用建議

  • Android 上需要適當的權限
  • iOS 使用者必須確認儲存動作
  • 僅限 Android 上的下載資料夾
  • 不支援自訂檔案路徑
  • 依賴於平台特定的系統對話方塊

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

document_file_save_plus

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_plus: ^1.0.4

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_plus/document_file_save_plus.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 項

  • plugin_platform_interface^2.1.3

原始碼儲存庫

使用此套件的專案

暫無相關資料。