factorial property

int get factorial

Calculates the factorial of the integer.

Example:

print(5.factorial); // 120

Implementation

int get factorial => this == 0
    ? 1
    : List.generate(toInt(), (index) => index + 1).reduce((value, element) => value * element);