Comparing only dates of DateTimes in Dart
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; }}
DateTime dateTime= DateTime.now();DateTime _pickedDate = // Some other DateTime instancedateTime.difference(_pickedDate).inDays == 0 // <- this results to true or false
Because difference() method of DateTime return results as Duration() object, we can simply compare days only by converting Duration into days using inDays property