sumOfDigits method
Returns the sum of digits of this number (integer part only).
123.sumOfDigits() // 6
Implementation
int sumOfDigits() {
var n = toInt().abs();
var sum = 0;
while (n > 0) {
sum += n % 10;
n ~/= 10;
}
return sum;
}