File class abstract

A reference to a file on the file system.

Implemented types

Constructors

File()

Properties

absolute → File
A FileSystemEntity whose path is the absolute path of path.
no setteroverride
basename → String
Gets the part of this entity's path after the last separator.
no setterinherited
dirname → String
Gets the part of this entity's path before the last separator.
no setterinherited
fileSystem → FileSystem
Returns the file system responsible for this entity.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
isAbsolute → bool
Whether this object's path is absolute.
no setterinherited
parent → Directory
The parent directory of this entity.
no setterinherited
path → String
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
uri → Uri
A Uri representing the file system entity's location.
no setterinherited

Methods

copy(String newPath) → Future<File>
Copies this file.
override
copySync(String newPath) → File
Synchronously copies this file.
override
create({bool recursive = false, bool exclusive = false}) → Future<File>
Creates the file.
override
createSync({bool recursive = false, bool exclusive = false}) → void
Synchronously creates the file.
inherited
delete({bool recursive = false}) → Future<FileSystemEntity>
Deletes this FileSystemEntity.
inherited
deleteSync({bool recursive = false}) → void
Synchronously deletes this FileSystemEntity.
inherited
exists() → Future<bool>
Checks whether the file system entity with this path exists.
inherited
existsSync() → bool
Synchronously checks whether the file system entity with this path exists.
inherited
lastAccessed() → Future<DateTime>
The last-accessed time of the file.
inherited
lastAccessedSync() → DateTime
The last-accessed time of the file.
inherited
lastModified() → Future<DateTime>
Get the last-modified time of the file.
inherited
lastModifiedSync() → DateTime
Get the last-modified time of the file.
inherited
length() → Future<int>
The length of the file.
inherited
lengthSync() → int
The length of the file provided synchronously.
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.
inherited
openRead([int? start, int? end]) → Stream<List<int>>
Creates a new independent Stream for the contents of this file.
inherited
openSync({FileMode mode = FileMode.read}) → RandomAccessFile
Synchronously opens the file for random access operations.
inherited
openWrite({FileMode mode = FileMode.write, Encoding encoding = utf8}) → IOSink
Creates a new independent IOSink for the file.
inherited
readAsBytes() → Future<Uint8List>
Reads the entire file contents as a list of bytes.
inherited
readAsBytesSync() → Uint8List
Synchronously reads the entire file contents as a list of bytes.
inherited
readAsLines({Encoding encoding = utf8}) → Future<List<String>>
Reads the entire file contents as lines of text using the given Encoding.
inherited
readAsLinesSync({Encoding encoding = utf8}) → List<String>
Synchronously reads the entire file contents as lines of text using the given Encoding.
inherited
readAsString({Encoding encoding = utf8}) → Future<String>
Reads the entire file contents as a string using the given Encoding.
inherited
readAsStringSync({Encoding encoding = utf8}) → String
Synchronously reads the entire file contents as a string using the given Encoding.
inherited
rename(String newPath) → Future<File>
Renames this file system entity.
override
renameSync(String newPath) → File
Synchronously renames this file system entity.
override
Resolves the path of a file system object relative to the current working directory.
inherited
resolveSymbolicLinksSync() → String
Resolves the path of a file system object relative to the current working directory.
inherited
setLastAccessed(DateTime time) → Future
Modifies the time the file was last accessed.
inherited
setLastAccessedSync(DateTime time) → void
Synchronously modifies the time the file was last accessed.
inherited
setLastModified(DateTime time) → Future
Modifies the time the file was last modified.
inherited
setLastModifiedSync(DateTime time) → void
Synchronously modifies the time the file was last modified.
inherited
stat() → Future<FileStat>
Calls the operating system's stat() function on path.
inherited
statSync() → FileStat
Synchronously calls the operating system's stat() function on path.
inherited
toString() → String
A string representation of this object.
inherited
watch({int events = FileSystemEvent.all, bool recursive = false}) → Stream<FileSystemEvent>
Start watching the FileSystemEntity for changes.
inherited
writeAsBytes(List<int> bytes, {FileMode mode = io.FileMode.write, bool flush = false}) → Future<File>
Writes a list of bytes to a file.
override
writeAsBytesSync(List<int> bytes, {FileMode mode = FileMode.write, bool flush = false}) → void
Synchronously writes a list of bytes to a file.
inherited
writeAsString(String contents, {FileMode mode = io.FileMode.write, Encoding encoding = utf8, bool flush = false}) → Future<File>
Writes a string to a file.
override
writeAsStringSync(String contents, {FileMode mode = FileMode.write, Encoding encoding = utf8, bool flush = false}) → void
Synchronously writes a string to a file.
inherited

Operators

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