countSeconds function

String countSeconds(
  1. int difference
)

Converts the time difference to a number of seconds. This function truncates to the lowest second. returns ("Just now" OR "X seconds")

Implementation

String countSeconds(int difference) {
  int count = (difference / 1000).truncate();
  return count > 1 ? '$count seconds' : 'Just now';
}