Hi is there a method from which I can update a specific line in a file. My file has data seperated by line break
Sample example to delete line but I have to write everything into file again, can I perform CRUD opertion directly on file lines ?
I want to update specific line in file wihout reading entire file => update string and => write all lines to file.
I may switch to any kind of file type that can offer me this functionality. Is there a way to store data in row column architecture like sql ?
import 'dart:io';
Future<void> myAsyncFunction() async {
const index = 5;
final File f = File('test.txt');
final List<String> lines = await f.readAsLines();
lines.removeAt(index);
await f.writeAsString(lines.join('\n'));
}