memo0<R> function
Lazy evaluates function and returns cached result on each call.
Implementation
Func0<R> memo0<R>(Func0<R> func) {
late R prevResult;
bool isInitial = true;
return (() {
if (!isInitial) {
return prevResult;
} else {
prevResult = func();
isInitial = false;
return prevResult;
}
});
}