update method

Future<V?> update(
  1. DatabaseClient databaseClient,
  2. V value
)

Update a record.

If it does not exist, return null. if value is a map, keys with dot values refer to a path in the map, unless the key is specifically escaped

Returns the updated value.

Implementation

Future<V?> update(DatabaseClient databaseClient, V value) async {
  var client = getClient(databaseClient);
  value = client.sembastDatabase
      .sanitizeInputValue<V>(value as Value, update: true);
  return await client.inTransaction((txn) {
    return client
        .getSembastStore(store)
        .txnUpdate(txn, value as Value, key as Key);
  }) as V?;
}