FileSync class
Provides a set of methods to read/write a file synchronisly.
The class is mostly used internally.
Note: the api to this class is considered EXPERIMENTAL and is subject to change.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- length → int
-
Returns the length of the file in bytes
The file does NOT have to be open
to determine its length.
no setter
- path → String
-
The path to this file.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
append(
String line, {String? newline = '\n'}) → void -
Appends the
line
to the file Ifnewline
is true then append a newline after the line. -
close(
) → void - Close and flushes a file to disk.
-
flush(
) → void - Flushes the contents of the file to disk.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
CancelableLineAction lineAction) → void -
reads every line from a file calling the passed
lineAction
for each line. if you return false from alineAction
call then the read returns and no more lines are read. -
readLine(
{String lineDelimiter = '\n'}) → String? -
Reads a single line from the file.
lineDelimiter
the end of line delimiter. May be one or two characters long. Defaults to \n. -
resolveSymLink(
) → String - This is just a wrapper for the method File.resolveSymbolicLinksSync. Returns the path the symbolic link links to.
-
toString(
) → String -
A string representation of this object.
inherited
-
truncate(
) → void - Truncates the file to zero bytes in length.
-
write(
String line, {String? newline = '\n'}) → void -
Truncates the file to zero bytes and
then writes the given text to the file.
If
newline
is null then no line terminator will be added.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited