Skip to main content
1

Delete Operations

Future<bool>
This method first checks for the file’s existence using exists() before attempting to call delete(). It is designed to be a non-crashing wrapper for file cleanup.
2

Read and Access

Future<Map<String, dynamic>?>
A non-crashing wrapper for reading and parsing JSON files.It handles three common failure modes gracefully:
  1. File does not exist.
  2. File exists but cannot be read (e.g., permission error).
  3. File content is not valid JSON.
Future<Uint8List?>
A safe wrapper around readAsBytes() that handles file existence and read errors gracefully. It is suitable for loading image or audio data.
Avoid calling this on the main thread for very large files.
3

Getters

int
A robust wrapper around lengthSync(), preventing crashes if the file is deleted or becomes inaccessible between checks.
DateTime?
Safely gets the file’s synchronous last modified timestamp without throwing an exception.
4

Comparators

bool
Checks if two File objects point to the same file location on the filesystem.