selectWebFile method
Implementation
Future<List<Uint8List?>> selectWebFile() async {
var result = await FilePicker.platform.pickFiles(
allowMultiple: true,
type: FileType.custom,
allowedExtensions: [
'jpg',
'jpeg',
'png',
'gif',
'svg',
'webp',
'bmp',
'pdf',
'doc',
'docx',
'xls',
'xlsx',
'ppt',
'pptx',
'txt',
'csv',
'zip',
'rar',
'7z',
'mp3',
'mp4',
'wav',
'avi',
'flv',
'mov',
'wmv',
'mpg',
'mpeg',
'm4v',
'3gp',
'mkv',
'webm',
],
);
if (result != null) {
List<Uint8List?> files = [];
for (var file in result.files) {
files.add(file.bytes);
}
// File? file = File(result.files.single.path!);
// log('image gotten');
return files;
} else {
// User canceled the picker
return [];
}
}