File class abstract
Abstract File entity.
- Inheritance
-
- Object
- FileSystemEntity
- File
- Implementers
Properties
- absolute → File
-
Returns a File instance whose path is the absolute path to
this
.no setter - fs → FileSystem
-
fs_shim specific
holds a reference to the file system
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
. Ifthis
is a root directory, returnsthis
.no setterinherited - path → String
-
Get the path of the file.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copy(
String newPath) → Future< File> -
Copy this file. Returns a
Future<File>
that completes with a File instance for the copied file. -
create(
{bool recursive = false}) → Future< File> -
Create the file. Returns a
`Future<File>`
that completes with the file when it has been created. -
delete(
{bool recursive = false}) → Future< FileSystemEntity> -
Deletes this FileSystemEntity.
inherited
-
exists(
) → Future< bool> -
Checks whether the file system entity with this path exists. Returns
a
`Future<bool>`
that completes with the result.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> - Create 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. The StreamSink must be closed when no longer used, to free system resources.
-
readAsBytes(
) → Future< Uint8List> -
Read the entire file contents as a list of bytes. Returns a
`Future<List<int>>`
that completes with the list of bytes that is the contents of the file. -
readAsString(
{Encoding encoding = utf8}) → Future< String> - Read the entire file contents as a string using the given Encoding.
-
rename(
String newPath) → Future< FileSystemEntity> -
Renames this file system entity. Returns a
Future<FileSystemEntity>
that completes with a FileSystemEntity instance for the renamed file system entity.inherited -
stat(
) → Future< FileStat> -
Calls the operating system's stat() function on the path of this
FileSystemEntity. Identical to
FileStat.stat(this.path)
.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
writeAsBytes(
Uint8List bytes, {FileMode mode = FileMode.write, bool flush = false}) → Future< File> - Write a list of bytes to a file.
-
writeAsString(
String contents, {FileMode mode = FileMode.write, Encoding encoding = utf8, bool flush = false}) → Future< File> - Write a string to a file.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited