Question from a newbie in Flutter and Dart:
With this code I let a user to pick mulitple mp4/avi files in flutter web:
`FilePickerResult? picked = await FilePicker.platform
.pickFiles(
allowMultiple: true,
type: FileType.custom,
allowedExtensions: ['mp4', 'avi']);`
Now I would need an exression to extrcat the file name (not the path) of the selected files. I was hoping in something like this:
List<File> file_names = picked.files.name.toList();
But this is wrong.
Any suggestion?
2
Answers
You can try like this to get
List<File>
Also,
FilePicker
supports picking files from the web so it should not be issue.And if you’re planning to upload files to firebase then make sure you upload in
Uint8List
format.You should try map function to extract the name property of each File object in the files list: