pick_or_save 0.1.2 pick_or_save: ^0.1.2 copied to clipboard
A Flutter file picking and saving package that enables you to pick or save a single file and multiple files.
Package description #
A Flutter file picking and saving package that enables you to pick or save a single file and multiple files.
Note: Although this package supports picking and caching files by default to work with them in flutter, it is actually built for those who manage files natively in android as this package supports disabling copying of file in cache to work with Android URIs directly.
Features #
- Works on Android 5.0 (API level 21) or later.
- Pick single file or multiple files.
- Get meta data like name, size and last modified for files.
- Saves single file while allowing user to choose location and name.
- Saves multiple file while allowing user to choose location or directory for saving all files.
- Saves file from either file path or file data.
- Filter extensions when picking a document.
- Could limit picking a file from the local device only.
Getting started #
- In pubspec.yaml, add this dependency:
pick_or_save:
- Add this package to your project:
import 'package:pick_or_save/pick_or_save.dart';
Basic Usage #
Picking single file #
List<String>? result = await PickOrSave().filePicker(
params: FilePickerParams(),
);
String filePath = result[0];
Note: Setting copyFileToCacheDir = false
will provide uri path which can only be used in android native platform.
Picking multiple files #
List<String>? filesPaths = await PickOrSave().filePicker(
params: FilePickerParams(filePickingType: FilePickingType.multiple),
);
Note: Setting copyFileToCacheDir = false
will provide uri paths which can only be used in android native platform.
Picking multiple files #
List<String>? filesPaths = await PickOrSave().filePicker(
params: FilePickerParams(filePickingType: FilePickingType.multiple),
);
Saving single file #
List<String>? result = await PickOrSave().fileSaver(
params: FileSaverParams(
sourceFilesPaths: [filePath],
filesNames: ["file.png"],
),
);
String savedFilePath = result[0];
Saving multiple files #
List<String>? savedFilesPaths = await PickOrSave().fileSaver(
params: FileSaverParams(
sourceFilesPaths: [file1Path, file2Path],
filesNames: ["file 1.png, file 2.png"],
),
);
Saving single file | Saving multiple files |
---|---|
File Metadata #
FileMetadata result = await PickOrSave().fileMetaData(
params: FileMetadataParams(sourceFileUri: fileUri),
);