saveMany method

Future<List<T>> saveMany({
  1. required List<T> items,
  2. required String userId,
  3. bool andSync = false,
  4. DataSource source = DataSource.local,
  5. bool forceRemoteSync = false,
  6. DatumSyncOptions<T>? syncOptions,
  7. DatumSyncScope? scope,
})

Implementation

Future<List<T>> saveMany({
  required List<T> items,
  required String userId,
  bool andSync = false,
  DataSource source = DataSource.local,
  bool forceRemoteSync = false,
  DatumSyncOptions<T>? syncOptions,
  DatumSyncScope? scope,
}) async {
  _ensureInitialized();
  final savedItems = <T>[];
  for (final item in items) {
    final savedItem = await push(item: item, userId: userId, source: source, forceRemoteSync: forceRemoteSync);
    savedItems.add(savedItem);
  }
  if (andSync) {
    await synchronize(userId, options: syncOptions, scope: scope);
  }
  return savedItems;
}