effect<T> method

ValueCell<T> effect<T>(
  1. T fn(), {
  2. dynamic key,
})

Create a cell with a side effect that is run whenever this cell is triggered..

The side effect fn is run only when this cell is triggered and only if the returned cell is observed. The value of the return cell is the value returned by the latest call to fn.

key identifies the cell containing the side effect.

Implementation

ValueCell<T> effect<T>(T Function() fn, {
  dynamic key
}) => ComputeCell(
    compute: fn,
    arguments: {this},
    key: key
).effectCell;