isYearCurrent method

  1. @useResult
bool isYearCurrent({
  1. DateTime? now,
})

Checks if the date is in the current calendar year.

Returns true if this date's year matches now's year. Pass now to override the current time (useful for testing). Audited: 2026-06-12 11:26 EDT

Implementation

@useResult
bool isYearCurrent({DateTime? now}) => year == (now ?? DateTime.now()).year;