lazyValue<T> method

T lazyValue<T>(
  1. T init()
)

Side effect that provides a way for capsules to hold onto some value between builds, where the initial value is computationally expensive.

Similar to the useRef hook from React; see https://react.dev/reference/react/useRef

Implementation

T lazyValue<T>(T Function() init) => use.callonce(init);