I have a large .csv file where I need to edit a single value. Is there a way to do that without writing the entire file again?
I know that I can read a file line-by-line like this:
await for (var event in file
.openRead()
.transform(utf8.decoder)
.transform(LineSplitter())) {
if (isLineToEdit) {
//edit the line
break;
}
}
However I don't know a way to edit a single line and write that to the file without having to write the entire file again. As far as I know, the only way to write to a file is by either overwriting it (FileMode.write
) or by appending at the end (FileMode.append
). Am I missing something? Is there some way to do that in dart?