isSameMonth method Null safety

bool isSameMonth(
  1. DateTime? dateA,
  2. DateTime? dateB
)

Returns true if the two DateTime objects have the same month and year, or are both null.

Implementation

static bool isSameMonth(DateTime? dateA, DateTime? dateB) {
  return
    dateA?.year == dateB?.year &&
    dateA?.month == dateB?.month;
}