File class abstract

A reference to a file on the file system.

Inheritance
Implementers

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}) StreamSink<List<int>>
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
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.

Operators

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