countYears function

String countYears(
  1. int difference
)

Implementation

String countYears(int difference) {
  int count = (difference / 31536000000).truncate();
  return count.toString() + (count > 1 ? ' years' : ' year');
}