close method

Future<void> close()

Implementation

Future<void> close() async {
  await _sink.close();
  // todo correct invalid data in file
  RandomAccessFile raf = await File(filename).open(mode: FileMode.writeOnlyAppend);
  // position of filesize
  Writebuffer writebuffer = Writebuffer();
  int length = await File(filename).length();
  writebuffer.appendInt8(length);
  await writebuffer.writeIntoAt(28, raf);
  await raf.close();
}