FileHandler class
Cross-platform file I/O.
On mobile (Android / iOS) files are written to
getApplicationDocumentsDirectory().
On desktop (Windows / macOS / Linux) files are written to the user's
Downloads folder (getDownloadsDirectory()), falling back to Documents.
On web there is no file system; callers should use DownloadService instead. All write methods return a descriptive error on web.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
deleteFile(
String absolutePath) → Future< bool> -
Delete a file at
absolutePath. Returnstrueon success. -
fileExists(
String absolutePath) → Future< bool> -
Check whether a file exists at
absolutePath. -
getOutputDirectoryPath(
{String? subDirectory}) → Future< String> - Returns the absolute path to the output directory (creates it if needed).
-
listXmlFiles(
{String? subDirectory}) → Future< List< String> > - List XML files in the default output directory.
-
readTextFile(
String absolutePath) → Future< FileReadResult> -
Read a text file from
absolutePath. -
writeBytesFile(
{required String fileName, required Uint8List bytes, String? subDirectory}) → Future< FileWriteResult> -
Write raw bytes to
fileNamein the platform output directory. -
writeTextFile(
{required String fileName, required String content, String? subDirectory}) → Future< FileWriteResult> -
Write
contentas UTF-8 text tofileNamein the platform output dir.