putAndGetAsync method

Future<T> putAndGetAsync(
  1. T object, {
  2. PutMode mode = PutMode.put,
})

Like putAsync, but returns a copy of the object with the (new) ID set.

If the object is new (its Id property is 0 or null), the returned copy will have its Id property set to the new ID. This also applies to new objects in its relations.

If the object or (new) ID is not needed, use putAsync instead.

See also putQueued which is optimized for running a large number of puts in parallel.

Implementation

Future<T> putAndGetAsync(T object, {PutMode mode = PutMode.put}) async =>
    await _store.runAsync(
        _putAndGetAsyncCallback<T>, _PutAsyncArgs(object, mode));