Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

flutter 'file picker ' error . the getter 'name' is not defined

This is a screenshot of my error screenshot of error
Please tell me why i am getting this error because according to documentation of file_picker file.name should return name of the file but instead i am getting getter name is not defined .

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

First, I think it would be better if you copy paste the code, otherwise people can’t reproduce the problem.

Anyway I think the problem is that you’re confusing PlatformFile with File (from the dart:io package). The first one has the attribute name, the second doesn’t, and you are trying to retrieve that attribute from an element of a List.

If you want the name of the files you should do

List<PlatformFile>? list_result;

if(result != null) {
    List<PlatformFile> files = result.files;
    setState((){
        list_result = files;
    });
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading