Is there any way to read just a chunk of bytes from a file in flutter not the whole data? For example from byte 50 to 150
I found the solution myself:
Directory directory = await getApplicationDocumentsDirectory();
File file = File('${directory.path}/myfile.txt');
RandomAccessFile raf= file.openSync(mode: FileMode.read);
raf.setPositionSync(50);
Uint8List data = raf.readSync(100);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With