LineFile class
Provide s collection of methods to make it easy to read/write a file line by line.
Constructors
- LineFile.new(String path, {FileMode fileMode = FileMode.writeOnlyAppend})
- If you instantiate FileSync you MUST call close.
Properties
Methods
-
append(
String line, {String? newline}) → void -
Appends the
line
to the file Appendsnewline
after the line. Ifnewline
is null or isn't passed then the platform end of line characters are appended as defined byPlatform().eol
. Pass null or an '' tonewline
to not add a line terminator. -
close(
) → void - Close and flushes the 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
-
open(
) → void - Opens the file for random access.
-
read(
{String? lineDelimiter}) → String? -
Reads a single line from the file.
lineDelimiter
the end of line delimiter. May be one or two characters long. Defaults to the platform specific delimiter as defined byPlatform().eol
. -
readAll(
bool handleLine(String)) → void - Read file line by line.
-
toString(
) → String -
A string representation of this object.
inherited
-
truncate(
) → void - Truncates the file to zero bytes in length.
-
write(
String line, {String? newline}) → void -
Truncates the file to zero bytes and
then writes the given text to the file.
If
newline
is null or isn't passed then the platform end of line characters are appended as defined byPlatform().eol
. Pass null or an '' tonewline
to not add a line terminator.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited