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);
  return await client.inTransaction((txn) {
    return client.getSembastStore(store).txnAdd(txn, value, key);
  });
}