add method

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

Create records that don't exist.

The list of values must match the list of keys.

Returns a list of the keys, if not inserted, a key is null.

Implementation

Future<List<K?>> add(DatabaseClient databaseClient, List<V> values) {
  if (values.length != keys.length) {
    throw ArgumentError('the list of values must match the list of keys');
  }
  var client = getClient(databaseClient);
  return client.inTransaction((txn) async {
    return await client
        .getSembastStore(store)
        .txnAddAll<K, V>(txn, values, keys);
  });
}