putAll method
Insert multiple values into this dataset.
Implementation
// TODO Find a way to make this return [void] for sync implementations
Future<void> putAll(Map<String, Map<String, dynamic>> dataset,
[bool isDeleted = false]) async {
// Ensure all incoming tables exist in local dataset
final badTables = dataset.keys.toSet().difference(tables);
if (badTables.isNotEmpty) {
throw 'Unknown table(s): ${badTables.join(', ')}';
}
// Ignore empty records
dataset.removeWhere((_, records) => records.isEmpty);
// Generate records with incremented canonical time
final hlc = canonicalTime.increment();
final records = dataset.map((table, values) => MapEntry(
table,
values.map((key, value) =>
MapEntry(key, Record(value, isDeleted, hlc, hlc)))));
// Store records
await putRecords(records);
onDatasetChanged(records.keys, hlc);
}