error<E extends Object> method
Create a cell which captures exceptions thrown during the computation of this cell.
If this cell throws an exception during the computation of its value,
the returned cell evaluates to the thrown exception.
If this cell does not throw during the computation of its value, the
value of the returned cell is null if all is true. If all is
false, its value is not updated.
If E is given, only exceptions of type E are captured, otherwise all
exceptions are captured.
A keyed cell is returned, which is unique for a given this, all and
exception type E.
Implementation
ValueCell<E?> error<E extends Object>({bool all = false}) => ValueCell.computed(() {
try {
this();
}
on E catch (e) {
return e;
}
catch (e) {
// To prevent errors being propagated through this cell
}
if (!all) {
ValueCell.none();
}
return null;
}, key: _ErrorCellKey<E>(this, all));