put method Null safety

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

Save a record, create if needed.

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

Returns the updated value.

Implementation

Future<V> put(DatabaseClient databaseClient, V value, {bool? merge}) async {
  var client = getClient(databaseClient);
  value = client.sembastDatabase.sanitizeInputValue<V>(value, update: merge)!;
  return (await client.inTransaction((txn) {
    return client
        .getSembastStore(store)
        .txnPut(txn, value, key, merge: merge);
  }) as V?)!;
}