setWithUpdater
void
setWithUpdater(
Updates value to the return value of computeNewValue.
Implementation
void setWithUpdater(T Function(T oldValue) computeNewValue) {
JSAny? updater(JSAny? oldValue) {
final dartOld = switch (oldValue) {
null => null as T,
final v => switch (v.dartify()) {
final T val => val,
_ => null as T,
},
};
final newVal = computeNewValue(dartOld);
return switch (newVal) {
null => null,
final Object obj => obj.jsify(),
};
}
_setValue(updater.toJS);
}