getMultipleFiles function
Implementation
Future<List<File>> getMultipleFiles({required FileType fileType}) async {
FilePickerResult? filePickerResult;
List<File> imgList = [];
FileType type = FileType.custom;
if (isIOS) {
type = FileType.image;
}
filePickerResult = await FilePicker.platform.pickFiles(
allowMultiple: true,
type: type,
allowedExtensions: ['jpg', 'png', 'jpeg']);
if (filePickerResult != null) {
filePickerResult.files.forEach((element) {
log('element: ${element.path.validate().split("/").last.split(".").last}');
if (element.path.validate().split("/").last.split(".").last.isNotEmpty) {
imgList.add(File(element.path!));
} else {
toast("Can not Add This file");
}
});
}
return imgList;
}