operator == method
Tests whether this Period is exactly the same as another.
Periods compare equal if and only if each of years, months and days are equal. Because "year" and "month" are flexible concepts—some years and months are different than others (leap years, February), comparing them to days would be ambiguous.
Period(days: 30) != Period(months: 1);
Period(years: 1) != Period(months: 12);
Period(years: 1).normalize() == Period(months: 12).normalize();
Implementation
@override
bool operator ==(Object other) =>
other is Period &&
years == other.years &&
months == other.months &&
days == other.days;