pick_or_save 2.1.8 pick_or_save: ^2.1.8 copied to clipboard
A Flutter file picking and saving package that enables you to pick or save a single file and multiple files.
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:path_provider/path_provider.dart';
import 'package:pick_or_save/pick_or_save.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Pick Or Save example',
debugShowCheckedModeBanner: false,
theme: ThemeData(useMaterial3: true),
darkTheme: ThemeData.dark(useMaterial3: true),
themeMode: ThemeMode.system,
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final _pickOrSavePlugin = PickOrSave();
List<bool> isSelected = [true, false];
bool _isBusy = false;
final bool _localOnly = false;
List<String>? _pickedFilePath;
@override
void initState() {
super.initState();
}
Future<List<String>?> _fileSaver(FileSaverParams params) async {
List<String>? result;
try {
setState(() {
_isBusy = true;
});
result = await _pickOrSavePlugin.fileSaver(params: params);
} on PlatformException catch (e) {
log(e.toString());
} catch (e) {
log(e.toString());
}
if (!mounted) return result;
setState(() {
_isBusy = false;
});
return result;
}
Future<List<String>?> _filePicker(FilePickerParams params) async {
List<String>? result;
try {
setState(() {
_isBusy = true;
});
result = await _pickOrSavePlugin.filePicker(params: params);
} on PlatformException catch (e) {
log(e.toString());
} catch (e) {
log(e.toString());
}
if (!mounted) return result;
setState(() {
_isBusy = false;
});
return result;
}
Future<FileMetadata?> _fileMetadata(FileMetadataParams params) async {
FileMetadata? result;
try {
result = await _pickOrSavePlugin.fileMetaData(params: params);
log(result.toString());
} on PlatformException catch (e) {
log(e.toString());
} catch (e) {
log(e.toString());
}
return result;
}
Future<String?> _cacheFilePathFromPath(
CacheFilePathFromPathParams params) async {
String? result;
try {
result = await _pickOrSavePlugin.cacheFilePathFromPath(params: params);
log(result.toString());
} on PlatformException catch (e) {
log(e.toString());
} catch (e) {
log(e.toString());
}
return result;
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
},
child: Scaffold(
appBar: AppBar(
title: const Text('Pick Or Save example'),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Picking",
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 8),
Card(
margin: EdgeInsets.zero,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
ToggleButtons(
onPressed: (int index) {
setState(() {
for (int buttonIndex = 0;
buttonIndex < isSelected.length;
buttonIndex++) {
if (buttonIndex == index) {
isSelected[buttonIndex] = true;
} else {
isSelected[buttonIndex] = false;
}
}
});
},
isSelected: isSelected,
children: const <Widget>[
Text(" Give URI "),
Text(" Give cached path "),
],
),
const Divider(),
CustomButton(
buttonText: 'Pick single file',
onPressed: _isBusy
? null
: () async {
final params = FilePickerParams(
localOnly: _localOnly,
getCachedFilePath: isSelected[1],
);
List<String>? result =
await _filePicker(params);
callSnackBar(
mounted: mounted,
context: context,
text: result.toString());
}),
const Divider(),
CustomButton(
buttonText: 'Pick multiple files',
onPressed: _isBusy
? null
: () async {
final params = FilePickerParams(
localOnly: _localOnly,
getCachedFilePath: isSelected[1],
enableMultipleSelection: true,
);
List<String>? result =
await _filePicker(params);
callSnackBar(
mounted: mounted,
context: context,
text: result.toString());
}),
const Divider(),
CustomButton(
buttonText: 'Pick only image and pdf mime types',
onPressed: _isBusy
? null
: () async {
final params = FilePickerParams(
localOnly: _localOnly,
getCachedFilePath: isSelected[1],
enableMultipleSelection: true,
mimeTypesFilter: [
"image/*",
"application/pdf"
]);
List<String>? result =
await _filePicker(params);
callSnackBar(
mounted: mounted,
context: context,
text: result.toString());
}),
Text(
"Note - This will show only these mimes for selection.",
style: Theme.of(context).textTheme.labelSmall,
),
const Divider(),
CustomButton(
buttonText: 'Pick only .txt extension types',
onPressed: _isBusy
? null
: () async {
final params = FilePickerParams(
localOnly: _localOnly,
getCachedFilePath: isSelected[1],
enableMultipleSelection: true,
allowedExtensions: [".txt"],
);
List<String>? result =
await _filePicker(params);
callSnackBar(
mounted: mounted,
context: context,
text: result.toString());
}),
Text(
"Note - This will show only these extensions for selection if the extension has a valid mime type if not it will still only pick that extension and reject others.",
style: Theme.of(context).textTheme.labelSmall,
),
const Divider(),
CustomButton(
buttonText: 'Open photo picker',
onPressed: _isBusy
? null
: () async {
final params = FilePickerParams(
localOnly: _localOnly,
getCachedFilePath: isSelected[1],
enableMultipleSelection: true,
allowedExtensions: [
".png",
".jpg",
".jpeg"
],
mimeTypesFilter: ["*/*"],
pickerType: PickerType.photo,
);
List<String>? result =
await _filePicker(params);
callSnackBar(
mounted: mounted,
context: context,
text: result.toString());
}),
Text(
"Note - This will show new photo picker on supported android devices and for unsupported the regular picker. Also it always needs mime type and only first mime type is selected for selection. Also, only pick provided extensions only and reject others.",
style: Theme.of(context).textTheme.labelSmall,
),
],
),
),
),
const SizedBox(height: 16),
Text(
"Saving",
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 8),
Card(
margin: EdgeInsets.zero,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
CustomButton(
buttonText: 'Saving single file from file path',
onPressed: _isBusy
? null
: () async {
File tempFile = await getTempFileFromData(
base64.decode(testBase64));
final params = FileSaverParams(
localOnly: _localOnly,
saveFiles: [
SaveFileInfo(
filePath: tempFile.path,
fileName: "single file.png")
]);
List<String>? result =
await _fileSaver(params);
callSnackBar(
mounted: mounted,
context: context,
text: result.toString());
}),
const Divider(),
CustomButton(
buttonText: 'Saving single file from Uint8List',
onPressed: _isBusy
? null
: () async {
final params = FileSaverParams(
localOnly: _localOnly,
saveFiles: [
SaveFileInfo(
fileData: testUint8List,
fileName: "single file.png")
],
);
List<String>? result =
await _fileSaver(params);
callSnackBar(
mounted: mounted,
context: context,
text: result.toString());
}),
const Divider(),
CustomButton(
buttonText: 'Saving multiple files',
onPressed: _isBusy
? null
: () async {
final params = FileSaverParams(
localOnly: _localOnly,
saveFiles: [
SaveFileInfo(
fileData: testUint8List,
fileName: "File 1.png"),
SaveFileInfo(
fileData: testUint8List,
fileName: "File 2.png")
],
);
List<String>? result =
await _fileSaver(params);
callSnackBar(
mounted: mounted,
context: context,
text: result.toString());
}),
],
),
),
),
const SizedBox(height: 16),
Text(
"Get Picked File Metadata",
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 8),
Card(
margin: EdgeInsets.zero,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
CustomButton(
buttonText: 'Pick single file',
onPressed: _isBusy
? null
: () async {
final params = FilePickerParams(
localOnly: _localOnly,
getCachedFilePath: isSelected[1],
);
_pickedFilePath = await _filePicker(params);
callSnackBar(
mounted: mounted,
context: context,
text: _pickedFilePath.toString());
}),
CustomButton(
buttonText: 'Display Metadata',
onPressed: _pickedFilePath == null
? null
: _pickedFilePath!.isEmpty
? null
: () async {
final params = FileMetadataParams(
filePath: _pickedFilePath![0],
);
FileMetadata? result =
await _fileMetadata(params);
callSnackBar(
mounted: mounted,
context: context,
text: result.toString());
}),
],
),
),
),
const SizedBox(height: 16),
Text(
"Get cache file path from Uri or Path",
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 8),
Card(
margin: EdgeInsets.zero,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
CustomButton(
buttonText: 'Pick single file',
onPressed: _isBusy
? null
: () async {
final params = FilePickerParams(
localOnly: _localOnly,
getCachedFilePath: isSelected[1],
);
_pickedFilePath = await _filePicker(params);
callSnackBar(
mounted: mounted,
context: context,
text: _pickedFilePath.toString());
}),
CustomButton(
buttonText: 'Display Cache file path',
onPressed: _pickedFilePath == null
? null
: _pickedFilePath!.isEmpty
? null
: () async {
final params =
CacheFilePathFromPathParams(
filePath: _pickedFilePath![0],
);
String? result =
await _cacheFilePathFromPath(params);
callSnackBar(
mounted: mounted,
context: context,
text: result.toString());
}),
],
),
),
),
],
),
),
),
);
}
}
Uint8List testUint8List = base64.decode(testBase64);
const String testBase64 =
"iVBORw0KGgoAAAANSUhEUgAAAyAAAAJYCAMAAACtqHJCAAADAFBMVEUAAAD///+A/4Cq/6qAv4CZzJmA1aqS25KA35+O46qAzJmL0aKV1ZWJ2J2S26SI3ZmPz5+H0qWO1ZyG16GM2ZmS256L3KKQ05uK1Z+P1qOJ2J2O2aGJ25uN056I1aKM1pyP15+L2KKP2p6K26CO1ZyK1p+N16GJ2J2M2Z+P2qKM1Z6O1aCL1pyO15+L2KGN2Z2K1Z+N1aGK1p6M16CO2J2M2Z+O2aGL1Z6N1p+L16GN156K2KCM2Z2K1Z+M1qCO156L15+N2KGL2J6N1aCL1p6M1p+K16CM156O2J+M2aGN1p+L1qCN156L15+N2KCL2J6M1p+L1qGM15+N16CM2J6N2J+L2KCN1p6L1p+M156L15+M2KCN2J6M1p+N1qCM156N15+L2J6N2J+L1qCM1p6L15+M16CN156M2J+N2J6M1p+N1qCL156M15+L2KCM2J+L1p+M1p6N15+M16CN156L2J+M1qCL1p+M15+L156M15+N2KCM2J6N1p+M16CN15+L15+M156L2J+M1qCL1p6M15+N16CM15+N2J+M2J6M1p+L16CM156L15+M16CN2J+M1p+N156M15+N16CM15+M2J+L1qCM1p+L15+M156N15+M2KCN2J+M1p+M16CM15+M15+L156M2J+L1qCM15+N15+M16CM15+M2J+M1p6M15+M16CL15+M15+N156M2J+N1p+M156M15+M16CM15+L2J+M1p6L15+M15+N15+M15+M16CM2J+M15+M156M15+L15+M15+N2J+M1qCN15+M15+M156M15+M15+M1p+M15+L16CM15+N15+M156M2J+M15+M15+M15+M16CM15+M15+L1p6M15+M15+M15+M15+M16CM1p+M15+M15+M15+M15+N15+M2J+M16CM15+M15+M15+M15+M15+M15+L15+M16CM15+M15+M15+M2J+M15+M15+M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0h/Gk3mVFrbmcIYSVrOaPSykEQIgBx129m1NlyVSyECEzCsN8YVQrHp0GIwNW67Q9GjcLHG0AINSkjf2dUKJjQBEKoSx29mxEvf3xdCGFP3Qd2M6LtHFMbQtiXOnITI9aOcbUhhJ74Id8xIm0aVQtCGNBjqoeRZunQOAhhyDETixlBSiafDCFMaj7+d0aIrfc0hBCmJQzK9rDm+3ZYEoRwRLvHdrBGK3itK4RwTsKgbA9rqqXD0iCEw9o/uZM10C/3/wNCBENs1qR81ijFk/vGQoigqXXxlBLWEBWLhtWGEEFWZ+jUMoa98iUjm0KIkGh+65cVDGMl06+qByFCqP7QyXkMS8VTh9aBECGXdPYLmxlmtrw2OBVChIujRy+pYJgoyh7dxQUhwkujC19YxVDzfPdw7yQIEZ6aXDxxDUNm3etDGkGI8NZ0yMvrGGx7Fz3UryGEqBlq9xg56ScGydapo3skQogapknfcdO200nlaz4YN7AJhKixWvQf/eoXu2jc5lmPXN45GUJEgkanXvfEzA0VNGDXso+euL5nBoSINMlHnX7FvS9O+2Enbdjz/SdPjex/bG0IEemS25162c3jnnr9k4Xfb9xNn4q3/rjg/efvHznkzC4tUyBEdMo4vHXHLl269MzKyjp30KDzs7K6dGnTumFGIoQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBDR4v8AamifEHY49NsAAAAASUVORK5CYII=";
Future<File> getTempFileFromData(Uint8List data) async {
Directory tempDir = await getTemporaryDirectory();
String tempPath = tempDir.path;
File tempFile = File('$tempPath/file.png');
tempFile.writeAsBytes(data);
return tempFile;
}
class CustomButton extends StatelessWidget {
const CustomButton({Key? key, required this.buttonText, this.onPressed})
: super(key: key);
final String buttonText;
final void Function()? onPressed;
@override
Widget build(BuildContext context) {
return Row(
children: [
Expanded(
child: OutlinedButton(
onPressed: onPressed,
child: Text(buttonText, textAlign: TextAlign.center)),
),
],
);
}
}
callSnackBar(
{required bool mounted,
required BuildContext context,
required String text}) {
if (mounted) {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(text),
));
}
}