isSameYear method

bool isSameYear(
  1. DateTime other
)

Checks if this date is in the same year as other.

Example:

print(DateTime(2023, 1, 1).isSameYear(DateTime(2023, 12, 31))); // true

Implementation

bool isSameYear(DateTime other) => year == other.year;