Result, State1, State2, State3> function
- Result Function() f(
Cache for 3 immutable states, and no parameters. Example:
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 = cache3states((List<String> names, int limit, String prefix) => () => names.where((str) => str.startsWith(prefix)).take(limit).toList());
Result Function() Function(State1, State2, State3) cache3states<Result, State1, State2, State3>( Result Function() Function(State1, State2, State3) f, ) => c.cache3states(f);