Result, State1> function
- Result Function() f(
Cache for 1 immutable state, and no parameters.
The first time this function is called with some state, it will calculate the result from it, and then return the result. When this function is called again with the same state (compared with the previous one by identity) it will return the same result, without having to calculate again. When this function is called again with a different from the previous one, it will evict the cache, recalculate the result, and cache it.
var selector = cache1((int limit) => () => stateNames.take(limit).toList());
Result? Function() Function(State1) cache1state<Result, State1>( Result Function() Function(State1) f, ) => c.cache1state(f);