save method

Future<void> save(
  1. String path
)

Writes the store to the file at path, overwriting it if it exists.

The write goes to a temporary file that is renamed into place, so a crash mid-write cannot destroy a previously saved index.

Implementation

Future<void> save(String path) async {
  final temp = File('$path.tmp.$pid');
  await temp.writeAsBytes(toBytes());
  await temp.rename(path);
}