Flutter Image Picker plugin assigns its own name to each picked file

Viewed 1486

I'm using the image picker plugin for flutter. Whenever I pick an image from the gallery, it is assigned a random name by the plugin, starting with 'image_picker.' How can I get the original name of the image file?

1 Answers

You can use method as mentioned below. It worked for me

var video = (await _picker.getVideo(source: ImageSource.gallery))!;

var videoName = video.path.split('/').last;
Related