Methods like fileFormattedSize() and fileToBase64String() use synchronous I/O (lengthSync, readAsBytesSync) and should be run off the main thread (e.g., in an Isolate or compute) for large files to prevent UI jank.
🔗 Path & Naming
Retrieves the absolute path of the file.final path = file.filePath();
// Output: /data/user/0/app.name/cache/temp.txt
Retrieves the file extension (the part after the last dot), e.g., “png”, “pdf”.print(File('/img/photo.png').fileExtension()); // png
fileNameWithoutExtension()
Retrieves the file name without the extension. “pdf”.print(File('/docs/report.pdf').fileNameWithoutExtension()); // report
🖼️ Content & Type Checks
Reads the file contents synchronously and converts them to a Base64 encoded string.final base64 = file.fileToBase64String();