put method

Future<List<V>> put(
  1. DatabaseClient databaseClient,
  2. List<V> values, {
  3. bool? merge,
})

Save multiple records, creating the one needed.

if merge is true and the field exists, data is merged.

The list of values must match the list of keys.

Returns the updated values.

Implementation

Future<List<V>> put(DatabaseClient databaseClient, List<V> values,
    {bool? merge}) {
  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)
            .txnPutAll<K, V>(txn, values, keys, merge: merge))
        .cast<V>();
  });
}