https://github.com/cleveroad/cr_file_saver
https://github.com/cleveroad/cr_file_saver
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/cleveroad/cr_file_saver
- Owner: Cleveroad
- License: mit
- Created: 2022-10-11T12:53:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-21T14:29:45.000Z (over 2 years ago)
- Last Synced: 2025-03-21T22:22:45.110Z (about 1 year ago)
- Language: Kotlin
- Size: 148 KB
- Stars: 3
- Watchers: 3
- Forks: 7
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# cr_file_saver

## Cleveroad introduces file saver for Flutter
### Features:
- Request WriteExternalStoragePermission for Android if needed.
- Save file to downloads directory on Android or Document folder on IOS.
- Save file through standard file saving dialog.
### Future features:
- Saving file to a specific directory.
## Setup
In the `pubspec.yaml` of your flutter project, add the following dependency:
```yaml
dependencies:
...
cr_file_saver: ^0.0.2
```
#### Android:
If you are using android 9 and below add this permission to project manifest:
```xml
```
#### iOS:
Add permissions in ios folder, go to ios/Runner/info.plist and add next keys:
```xml
LSSupportsOpeningDocumentsInPlace
UIFileSharingEnabled
```
In your dart file add the following import:
```dart
import 'package:cr_file_saver/cr_file_saver.dart';
```
## Usage
```CRFileSaver``` has several static methods to work with:
* ```requestWriteExternalStoragePermission``` to check for permission and ask it if needed.
* ```saveFile``` simply saving file with provided file path and desired file name.
* ```saveFileWithDialog``` save file through standard file saving dialog. Note that this method will throw ```NoResolvedActivityException``` if Android device has 30 api or higher