add method Null safety

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

Add a record, returns its generated key.

Implementation

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