tryUpdate method
- @Deprecated('Use updateKey(key, updater, ifAbsent: ...) instead. ' 'Will be removed in v3.0.0.')
- K key,
- V update(
- V value
- V ifAbsent()?,
Update value with error handling
Implementation
@Deprecated('Use updateKey(key, updater, ifAbsent: ...) instead. '
'Will be removed in v3.0.0.')
RxResult<V> tryUpdate(K key, V Function(V value) update,
{V Function()? ifAbsent}) {
return RxResult.tryExecute(() {
final newMap = Map<K, V>.from(value);
final result = newMap.update(key, update, ifAbsent: ifAbsent);
value = newMap;
return result;
}, 'update map value');
}