File class

Inheritance
Implemented types

Constructors

File(String path)
File.fromUri(Uri uri)

Properties

absolute File
A FileSystemEntity whose path is the absolute path of path.
no setteroverride
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.
finalinherited

Methods

copy(String newPath) Future<File>
Copies this file.
override
copySync(String newPath) File
Synchronously copies this file.
override
create({bool recursive = false}) Future<File>
override
createSync({bool recursive = false}) File
override
delete({bool recursive = false}) Future<FileSystemEntity>
Deletes this FileSystemEntity.
inherited
deleteSync({bool recursive = false}) File
Synchronously deletes this FileSystemEntity.
override
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.
override
lastAccessedSync() DateTime
The last-accessed time of the file.
override
lastModified() Future<DateTime>
Get the last-modified time of the file.
override
lastModifiedSync() DateTime
Get the last-modified time of the file.
override
length() Future<int>
The length of the file.
override
lengthSync() int
The length of the file provided synchronously.
override
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.
override
openRead([int? start, int? end]) Stream<List<int>>
Creates a new independent Stream for the contents of this file.
override
openSync({FileMode mode = FileMode.read}) RandomAccessFile
Synchronously opens the file for random access operations.
override
openWrite({FileMode mode = FileMode.write, Encoding encoding = utf8}) IOSink
Creates a new independent IOSink for the file.
override
readAsBytes() Future<Uint8List>
Reads the entire file contents as a list of bytes.
override
readAsBytesSync() Uint8List
Synchronously reads the entire file contents as a list of bytes.
override
readAsLines({Encoding encoding = utf8}) Future<List<String>>
Reads the entire file contents as lines of text using the given Encoding.
override
readAsLinesSync({Encoding encoding = utf8}) List<String>
Synchronously reads the entire file contents as lines of text using the given Encoding.
override
readAsString({Encoding encoding = utf8}) Future<String>
Reads the entire file contents as a string using the given Encoding.
override
readAsStringSync({Encoding encoding = utf8}) String
Synchronously reads the entire file contents as a string using the given Encoding.
override
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.
override
setLastAccessedSync(DateTime time) → void
Synchronously modifies the time the file was last accessed.
override
setLastModified(DateTime time) Future
Modifies the time the file was last modified.
override
setLastModifiedSync(DateTime time) → void
Synchronously modifies the time the file was last modified.
override
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 = 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.
override
writeAsString(String contents, {FileMode mode = FileMode.write, Encoding encoding = utf8, bool flush = false}) Future<File>
Writes a string to a file.
override
writeAsStringSync(String contents, {dynamic mode = FileMode.write, Encoding encoding = utf8, bool flush = false}) → void
Synchronously writes a string to a file.
override

Operators

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