countSeconds method
Converts the time difference to a number of seconds.
Returns the number of seconds between the current DateTime instance and differenceDateTime
.
If differenceDateTime
is not provided, the current system DateTime is used.
Implementation
int countSeconds(DateTime? differenceDateTime) {
int difference =
(differenceDateTime ?? DateTime.now()).millisecondsSinceEpoch -
millisecondsSinceEpoch;
int count = (difference / 1000).truncate();
// return count > 1 ? count.toString() + ' seconds' : 'Just now';
return count;
}