factorial property
Returns the factorial of this.
Implementation
int get factorial {
if (this < 0) {
throw ErrorOfType<InvalidFunctionParameter>(
message: 'The getter factorial is not defined for negative numbers.',
invalidState: '$this < 0.',
);
}
if (this == 0) {
return 1;
} else {
return _cache[this] ??= this * (this - 1).factorial;
}
}