Result, State1, State2> function
- Result Function() f(
Cache for 2 immutable states, and no parameters.
The first time this function is called with some states, it will calculate the result from them, and then return the result. When this function is called again with the same states (compared with the previous ones by IDENTITY) it will return the same result, without having to calculate again. When this function is called again with any of the states (or both) different from the previous ones, it will evict the cache, recalculate the result, and cache it.
var selector = cache2((List<String> names, int limit) => () => names.where((str) => str.startsWith("A")).take(limit).toList());
Result Function() Function(State1, State2) cache2states<Result, State1, State2>( Result Function() Function(State1, State2) f, ) => c.cache2states(f);