utils/io/read_write library

Extensions

DirectoryEmptyOrCreateExt on Directory
Empty or create helper
FsShimFileLinesIoFileExt on File
Extension on File to read and write lines.

Functions

emptyOrCreateDirectory(Directory dir) Future
Ensure the directory is created and empty. @Deprecated
linesFromIoString(String text) List<String>
Convert a single string with to a list of lines (ignoring line endings).
linesToIoString(List<String> lines) String
Convert a list of lines to a single string with line endings.
readLines(File file, {Encoding encoding = utf8}) Future<List<String>>
Read string content as lines
readString(File file, {Encoding encoding = utf8}) Future<String>
Read string content.
stringToIoString(String text) String
Fix lines ending
writeBytes(File file, Uint8List bytes) Future<File>
Write bytes content. Does not fail
writeLines(File file, List<String> lines, {Encoding encoding = utf8, bool? useCrLf}) Future<File>
Write lines content. Does not fail Uses CR/LF if useCrLf is true or if null and on windows
writeString(File file, String content, {Encoding encoding = utf8}) Future<File>
Write a file string context. Does not fail