Skip to main content
1

Getters

type
FileType
Resolves and returns the general FileType based on a hierarchical check of the file’s extension and name.
final type = File('song.mp3').type; // FileType.audio

switch (type) {
    case FileType.image: ...
    case FileType.unknown: ...
}
isImage
bool
Checks if the file is likely a raster image based on its extension.Supports common formats: jpg, jpeg, png, gif, bmp, webp.
print(File('profile.JPG').isImage); // true
isAudio
bool
Checks if the file is likely an audio file.Supports common formats: mp3, wav, aac, flac, m4a, ogg, wma.
print(File('music.mp2').isAudio); // true
isVideo
bool
Checks if the file is likely a video file.Supports common formats: mp4, mkv, mov, avi, webm, wmv.
print(File('clip.mp4').isVideo); // true
isDocument
bool
Checks if the file is a general-purpose document, covering text, office, and PDF formats.This is a broad check, combining the extensions from isTextDocument, isSpreadsheet, and isPresentation.
print(File('docs.xlsx').isDocument); // true
isPresentation
bool
Checks if the file is a presentation file format.Supports common formats: ppt, pptx, key, odp.
print(File('docs.ppt').isPresentation); // true
isSpreadsheet
bool
Checks if the file is a spreadsheet file format.Supports common formats: xls, xlsx, csv, ods and more.
print(File('docs.csv').isSpreadsheet); // true
isTextDocument
bool
Checks if the file is a general text or readable document file (PDF, Word, Markdown, etc.).Supports common formats: pdf, doc, docx, txt and more.
print(File('sampleTextFile.txt').isTextDocument); // true
isExecutable
bool
Checks if the file is likely an executable or system binary file.Supports common formats: exe, apk, aab, dmg, bat, sh, bin, iso, msi.
print(File('ExeFile.exe').isExecutable); // true
isCode
bool
Checks if the file is a source code, markup, or configuration file.Supports common formats: dart, js, ts, py, java, kt, swift, c, cpp, html, css, json, xml, yaml, yml.
print(File('sampleFile.java').isCode); // true
isArchive
bool
Checks if the file is an archive (compressed folder).Supports common formats: zip, rar, 7z, tar, gz, bz2.
print(File('sampleFile.rar').isArchive); // true
isVector
bool
Checks if the file is a vector graphic or design file.Supports common formats: svg, ai, eps, fig, psd.
print(File('sampleFile.psd').isVector); // true
isHidden
bool
Checks if the file is hidden, based on the Unix convention of starting the filename with a dot (.).
print(File('.htaccess').isHidden); // true