save method

Future<File> save(
  1. List<Object> simpleObjs, {
  2. bool append = false,
})

Saves the given simple objects. If append is false (the default), the file will be overwritten. If append is true, it will write to the end of the file.

Implementation

Future<File> save(List<Object> simpleObjs, {bool append = false}) async {
  _checkIfFileSystemIsTheSame();
  File file = _file ?? await this.file();
  await file.create(recursive: true);

  Uint8List encoded = LocalPersist.encode(simpleObjs);

  return file.writeAsBytes(
    encoded,
    flush: true,
    mode: append ? FileMode.writeOnlyAppend : FileMode.writeOnly,
  );
}