isThisYear method

bool isThisYear([
  1. DateTime? dateTime
])

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

dateTime: Time to compare.

Implementation

bool isThisYear([DateTime? dateTime]) {
  dateTime ??= DateTime.now();
  return year == dateTime.year;
}