flutter_file_saver 0.5.1
flutter_file_saver: ^0.5.1 copied to clipboard
Interface to provide a way to save files on the device in Flutter.
flutter_file_saver #
Interface to provide a way to save files on the device in Flutter.
Platform Support #
Android | iOS | Web | Windows | Linux | MacOS | |
---|---|---|---|---|---|---|
writeFileAsBytes |
✅ | ✅ | ✅ | ❌️ | ❌️ | ✅ |
writeFileAsString |
✅ | ✅ | ✅ | ❌️ | ❌️ | ✅ |
Setup #
Import the package #
dependencies:
flutter_file_saver: any
Android (Only for Android 10 and above) #
In your android/app/src/main/AndroidManifest.xml
, add:
WRITE_EXTERNAL_STORAGE
,MANAGE_EXTERNAL_STORAGE
,android:requestLegacyExternalStorage="true"
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.my_app">
<!-- ... -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<application android:requestLegacyExternalStorage="true" android:label="MyApp" android:name="${applicationName}">
<!-- ... -->
</application>
</manifest>
Permission request is managed by the package.
iOS #
Add the following permissions to your ios/Runner/Info.plist
:
<key>UISupportsDocumentBrowser</key>
<true/>
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
MacOS (Only for MacOS 10.9 and above) #
Add the following permissions to your macos/Runner/DebugProfile.entitlements
:
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
Todo #
- Support for Windows & Linux
- Support custom local paths