call method
Returns the result of calling func
or a cached result if available.
- The cache is initialized when first accessed.
- To re-initialize the cached function result use the
optional parameter
recalculate
.
Implementation
T call(
A arg, {
bool recalculate = false,
}) {
if (recalculate) {
return _functionTable[arg] = func(arg);
} else {
return _functionTable[arg] ??= func(arg);
}
}