cache1state_1param<Result, State1, Param1> function Null safety

Result Function(Param1) Function(State1) cache1state_1param<Result, State1, Param1>(
  1. Result Function(Param1) f(
    1. State1
    )
)

Cache for 1 immutable state, and 1 parameter.

When this function is called with some state and some parameter, it will check if it has the cached result for this state/parameter combination. If so, it will return it from the cache, without having to recalculate it again. If the result for this state/parameter combination is not yet cached, it will calculate it, cache it, and then return it. Note: The cache has one entry for each different parameter (comparing parameters by EQUALITY).

Cache eviction: Each time this function is called with some state, it will compare it (by IDENTITY) with the state from the previous time the function was called. If the state is different, the cache (for all parameters) will be evicted. In other words, as soon as the state changes, it will clear all cached results and start all over again.

Example:

var selector = cache1_1((List<String> state) =>
   (String startString) =>
   state.where((str) => str.startsWith(startString)).toList());

Implementation

Result Function(Param1) Function(State1) cache1state_1param<Result, State1, Param1>(
  Result Function(Param1) Function(State1) f,
) =>
    c.cache1state_1param(f);