pick_or_save 1.0.5 copy "pick_or_save: ^1.0.5" to clipboard
pick_or_save: ^1.0.5 copied to clipboard

PlatformAndroid
outdated

A Flutter file picking and saving package that enables you to pick or save a single file and multiple files.

pub package wakatime

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(enableMultipleSelection: true),
);

Note: Setting copyFileToCacheDir = false will provide uri paths which can only be used in android native platform.

Saving single file #

List<String>? result = await PickOrSave().fileSaver(
  params: FileSaverParams(
    saveFiles: [
      SaveFileInfo(
          filePath: filePath,
          fileName: "File.png")
    ],
  )
);
String savedFilePath = result[0];

Saving multiple files #

Saving multiple files from File

List<String>? result = await PickOrSave().fileSaver(
  params: FileSaverParams(
    saveFiles: [
      SaveFileInfo(
          filePath: filePath,
          fileName: "File 1.png"),
      SaveFileInfo(
          filePath: filePath,
          fileName: "File 2.png")
    ],
  )
);

Saving multiple files from Uint8List

List<String>? result = await PickOrSave().fileSaver(
  params: FileSaverParams(
    saveFiles: [
      SaveFileInfo(
          fileData: uint8List,
          fileName: "File 1.png"),
      SaveFileInfo(
          fileData: uint8List,
          fileName: "File 2.png")
    ],
  )
);
Saving single file Saving multiple files
WhatsApp Image 2022-09-19 at 1 34 02 PM WhatsApp Image 2022-09-19 at 1 33 04 PM

File Metadata #

FileMetadata result = await PickOrSave().fileMetaData(
  params: FileMetadataParams(sourceFileUri: fileUri),
);
35
likes
160
pub points
86%
popularity

Publisher

verified publisherdeepanshuchaudhary.com

A Flutter file picking and saving package that enables you to pick or save a single file and multiple files.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on pick_or_save