File class abstract

A reference to a file on the file system.

Inheritance
Implementers
Available extensions

Constructors

File(String path)
Creates a File object.
factory

Properties

absolute → File
Returns a File instance whose path is the absolute path to this.
no setter
fs → FileSystem
The file system for this entity.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
isAbsolute → bool
Returns a bool indicating whether this object's path is absolute.
no setterinherited
parent → Directory
The directory containing this.
no setterinherited
path → String
The path of the entity.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

copy(String newPath) → Future<File>
Copies this file.
create({bool recursive = false}) → Future<File>
Create the file.
delete({bool recursive = false}) → Future<FileSystemEntity>
Deletes this FileSystemEntity.
inherited
exists() → Future<bool>
Checks whether the file system entity with this path exists.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open({FileMode mode = FileMode.read}) → Future<RandomAccessFile>
Opens the file for random access operations.
openRead([int? start, int? end]) → Stream<Uint8List>
Creates a new independent Stream for the contents of this file.
openWrite({FileMode mode = FileMode.write, Encoding encoding = utf8}) → FileStreamSink
Creates a new independent StreamSink for the file.
readAsBytes() → Future<Uint8List>
Reads the entire file contents as a list of bytes.
readAsString({Encoding encoding = utf8}) → Future<String>
Reads the entire file contents as a string using the given Encoding.
rename(String newPath) → Future<FileSystemEntity>
Renames this file system entity.
inherited
stat() → Future<FileStat>
Calls the operating system's stat() function on the path of this FileSystemEntity.
inherited
toString() → String
A string representation of this object.
inherited
unsandbox() → File

Available on File, provided by the FsShimFileExtension extension

Unsandbox this file, returning the corresponding file in the underlying (non-sandboxed) delegate file system.
writeAsBytes(Uint8List bytes, {FileMode mode = FileMode.write, bool flush = false}) → Future<File>
Writes a list of bytes to a file.
writeAsString(String contents, {FileMode mode = FileMode.write, Encoding encoding = utf8, bool flush = false}) → Future<File>
Writes a string to a file.
writeStream(Stream<List<int>> stream) → Future<File>

Available on File, provided by the FileStreamToFileExt extension

Write the content of stream to this file, creating the parent directory if missing. See streamToFile.

Operators

operator ==(Object other) → bool
The equality operator.
inherited