updateAndSync method
Future<(T, DatumSyncResult<T> )>
updateAndSync({
- required T item,
- required String userId,
- DatumSyncOptions<
DatumEntityBase> ? syncOptions,
Updates an entity locally and immediately triggers a synchronization.
This is an alias for pushAndSync and is provided for semantic clarity. It's useful for operations that require immediate confirmation from the remote server.
Returns a tuple containing the locally saved entity and the sync result.
Implementation
Future<(T, DatumSyncResult<T>)> updateAndSync({
required T item,
required String userId,
DatumSyncOptions? syncOptions,
}) async {
_ensureInitialized();
// `push` handles both create and update, so this is equivalent to pushAndSync.
final savedItem = await push(item: item, userId: userId);
final syncResult = await synchronize(userId, options: syncOptions);
return (savedItem, syncResult);
}