add method

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

Create the record if it does not exist.

Returns the key if inserted, null otherwise.

Implementation

Future<K?> add(DatabaseClient databaseClient, V value) async {
  var client = getClient(databaseClient);
  value = client.sembastDatabase.sanitizeInputValue<V>(value as Value);
  return await client.inTransaction((txn) {
    return client.getSembastStore(store).txnAdd<K>(txn, value as Value, key);
  });
}