imemo7<A, B, C, D, E, F, G, R> function
Checks 7 arguments for equality with identical call and returns cached result if they were not changed.
Implementation
Func7<A, B, C, D, E, F, G, R> imemo7<A, B, C, D, E, F, G, R>(
Func7<A, B, C, D, E, F, G, R> func) {
late A prevArgA;
late B prevArgB;
late C prevArgC;
late D prevArgD;
late E prevArgE;
late F prevArgF;
late G prevArgG;
late R prevResult;
bool isInitial = true;
return ((A argA, B argB, C argC, D argD, E argE, F argF, G argG) {
if (!isInitial &&
identical(argA, prevArgA) &&
identical(argB, prevArgB) &&
identical(argC, prevArgC) &&
identical(argD, prevArgD) &&
identical(argE, prevArgE) &&
identical(argF, prevArgF) &&
identical(argG, prevArgG)) {
return prevResult;
} else {
prevArgA = argA;
prevArgB = argB;
prevArgC = argC;
prevArgD = argD;
prevArgE = argE;
prevArgF = argF;
prevArgG = argG;
prevResult = func(argA, argB, argC, argD, argE, argF, argG);
isInitial = false;
return prevResult;
}
});
}