flutter calculate months between two dates code example
Example: compare date month and year in datetime in flutter
Since I asked this, extension methods have been released in Dart. I would now
implement option 1 as an extension method:
extension DateOnlyCompare on DateTime {
bool isSameDate(DateTime other) {
return this.year == other.year && this.month == other.month
&& this.day == other.day;
}
}
About Extensions :
https://dart.dev/guides/language/extension-methods