getFileFromDevice static method
Implementation
static Future<List<File>> getFileFromDevice({
bool allowMultiple = false,
}) async {
try {
FilePickerResult? result = await FilePicker.pickFiles(
type: FileType.custom,
withData: true,
allowMultiple: allowMultiple,
allowedExtensions: ["png", "jpg", "jpeg", "pdf", "txt", "csv", "xlsx"],
);
return (result?.files ?? [])
.map((PlatformFile file) => File(file.path.toString()))
.toList();
} catch (e) {
return [];
}
}