Skip to content

pathconnected/flutter_file_saver

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flutter_file_saver

melos Pub Version

Interface to provide a way to save files on the device in Flutter.

Platform Support

Android iOS Web Windows Linux MacOS
writeFileAsBytes ❌️ ❌️
writeFileAsString ❌️ ❌️

Under the hood, each implementation tries to use the native dialog to save the file:

Getting Started

Import the package

dependencies:
    flutter_file_saver: any

Platform Setup

Android Setup
android {
    defaultConfig {
        minSdkVersion 19
    }
}

Check example

iOS Setup (Needs iOS 16+)

Add the following permissions to your ios/Runner/Info.plist:

<key>UISupportsDocumentBrowser</key>
<true/>
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>

Check example

MacOS Setup

Add the following permissions to your macos/Runner/DebugProfile.entitlements:

<key>com.apple.security.files.user-selected.read-write</key>
<true/>

Check example

Methods

writeFileAsBytes

Write a file on the device from a Uint8List.

FlutterFileSaver().writeFileAsBytes(
    fileName: 'file.txt',
    bytes: fileBytes,
);

writeFileAsString

Write a file on the device from a String. This will most of the time convert your data and perform a call to writeFileAsBytes.

FlutterFileSaver().writeFileAsString(
    fileName: 'file.txt',
    string: 'Hello World!',
);

About

Interface to provide a way to save files on the device in Flutter.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 30.4%
  • C++ 21.3%
  • CMake 18.4%
  • Swift 12.8%
  • Kotlin 9.1%
  • Ruby 4.6%
  • Other 3.4%