writePath method

void writePath(
  1. String? resolverPath,
  2. String path,
  3. dynamic value,
  4. bool encrypted,
)

Implementation

void writePath(
  String? resolverPath,
  String path,
  dynamic value,
  bool encrypted,
) async {
  resolverPath ??= '';

  final store = encrypted ? _encryptedStore : _plaintextStore;
  final otherStore = encrypted ? _plaintextStore : _encryptedStore;

  // If the document was previously not encrypted and now is or vice-versa, then it should be removed
  // from the other store.
  otherStore._deletePath(resolverPath, path);

  store.isDirty = true;
  final valueStore = store._store.get(resolverPath) ??
      store._store.write(resolverPath, ValueStore());
  valueStore.write(path, value);
}