putAllAndUpdateExistingMapped<TMapped> method
Future<void>
putAllAndUpdateExistingMapped<TMapped>(
- Map<
TKey, TMapped> newValues, - TVal mutateExisting(
- TKey key,
- TVal? mutateMe,
- TMapped newValue
override
Same as putAllAndUpdateExisting but mutateExisting
can receive a null existing value
Implementation
@override
Future<void> putAllAndUpdateExistingMapped<TMapped>(
Map<TKey, TMapped> newValues,
TVal Function(TKey key, TVal? mutateMe, TMapped newValue) mutateExisting,
) async {
final actualNewValue = <TKey, TVal>{};
for (var item in newValues.entries) {
final key = item.key;
final val = item.value;
final res = await getValueById(key, defaultValue: null);
actualNewValue[key] = mutateExisting(key, res, val);
}
await putAll(actualNewValue);
}