Alok Kumar
Alok Kumar

Reputation: 433

How to know whether files and folder are hidden in flutter?

I am building simple file manager app but it is showing all file and folder even hidden items also. I couldn't find any library in dart or plugin for this as available in Java or python.

Is there any similar code in dart for Flutter like this dir.Attributes.HasFlag(FileAttributes.Hidden)

I want hidden folder and files to be hidden.

enter image description here

Upvotes: 0

Views: 2105

Answers (1)

T Tse
T Tse

Reputation: 846

Android and iOS are both based on unix, and files are considered "hidden" if it starts with a dot. So the check you want would be boolean isHidden = filename.startsWith(".");

https://en.wikipedia.org/wiki/Hidden_file_and_hidden_directory#Unix_and_Unix-like_environments

In Unix-like operating systems, any file or folder that starts with a dot character (for example, /home/user/.config), commonly called a dot file or dotfile, is to be treated as hidden.

Upvotes: 1

Related Questions