isThisSecond method

bool isThisSecond([
  1. DateTime? dateTime
])

True if the specified time or the current time is the same second.

Pass the date and time you want to compare to dateTime. If it is not passed, the current date and time is used.

Implementation

bool isThisSecond([DateTime? dateTime]) {
  dateTime ??= DateTime.now();
  return year == dateTime.year &&
      month == dateTime.month &&
      day == dateTime.day &&
      hour == dateTime.hour &&
      minute == dateTime.minute &&
      second == dateTime.second;
}