sync method
Implementation
Future<MapDiffs<K, V>> sync(FutureOr<Map<K, V>> newMap, {bool async = true}) async {
final nm = await newMap;
try {
if (async) {
final changes = await this.safeCast<K, V>().differencesAsync(
nm,
checkValues: true,
debugName: debugLabel,
valueEquality: _diffEquality,
);
applyChanges(changes);
return changes;
} else {
final changes = this.safeCast<K, V>().differences(
nm,
checkValues: true,
valueEquality: _diffEquality,
);
applyChanges(changes);
return changes;
}
} catch (e, stack) {
// ignore: unnecessary_brace_in_string_interps
log.severe("has issues syncing ${nm.length} records: $e", e, stack);
return MapDiffs<K, V>.builder(this.safeCast<K, V>());
}
}