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 ??= '';

  // If the document was previously not encrypted and now is, then it should be removed
  // from the plaintext store and added to the encrypted one and vice-versa.
  if (encrypted) {
    if (_plaintextStore.hasValue(resolverPath, path)) {
      _plaintextStore.shallowDelete(resolverPath, path);
    }
    _encryptedStore.writePath(resolverPath, path, value);
  } else {
    if (_encryptedStore.hasValue(resolverPath, path)) {
      _encryptedStore.shallowDelete(resolverPath, path);
    }
    _plaintextStore.writePath(resolverPath, path, value);
  }
}