call method

V call({
  1. bool shouldUpdate = false,
})

Calls the wrapped computation and returns the cached value.

If shouldUpdate is set to true or the value is marked as expired, it will recompute the value. Otherwise, it will return the cached value.

Implementation

V call({bool shouldUpdate = false}) {
  if (isNotComputedYet || shouldUpdate || isExpired) {
    _memoized = _computation();
    _status = MemoizedStatus.computed;
  }
  return _memoized;
}