putAsync method

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

Like put, but runs in a worker isolate and does not modify the given object, e.g. to set a new ID.

Use get to get an inserted object with its new ID set, or use putAndGetAsync instead.

See putManyAsync to put several objects at once with better performance.

If you need to call this multiple times consider using the synchronous variant (e.g. put) and wrap the calls in Store.runInTransactionAsync. This has typically better performance as only a single worker isolate has to be spawned.

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

Implementation

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