percentage method
Returns this number as a percentage of total, formatted to precision
decimal places.
25.percentage(200) // '12.5%'
Implementation
String percentage(num total, {int precision = 1}) {
if (total == 0) return '0%';
return '${((this / total) * 100).toStringAsFixed(precision)}%';
}