mutableString method
Return a cell which evaluates to a string representation of this cell's value.
The returned cell is a mutable computed cell. If the value of the returned cell is set explicitly, a num is parsed from the assigned string value, wrapped in a Maybe, which is assigned to this cell's value.
If an exception is thrown during parsing, a Maybe holding the exception is assigned to this cell's value.
Implementation
MutableCell<String> mutableString({NumberFormat? format}) =>
MutableComputeCell(
arguments: {this},
compute: () =>
format?.format(value.unwrap) ?? value.unwrap.toString(),
reverseCompute: (value) {
this.value =
Maybe.wrap(() => format?.parse(value) ?? num.parse(value));
});