Answers for "flutter datetime grater than datetime"

0

fluter check that date is greater than another date

var now = new DateTime.now();
var berlinWallFellDate = new DateTime.utc(1989, 11, 9);
// 0 denotes being equal positive value greater and negative value being less
if(berlinWallFellDate.compareTo(now)>0)
{
  //peform logic here.....
}
Posted by: Guest on August-30-2020
0

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
Posted by: Guest on March-15-2021

Code answers related to "Dart"

Browse Popular Code Answers by Language