percentageOfOrZero method

double percentageOfOrZero(
  1. num total
)

Returns the percentage of this number in relation to total.

If the total is zero, returns zero.

Implementation

double percentageOfOrZero(num total) => total == 0 ? 0 : this / total;