W3cubDocs

/Dart 2

operator == method

bool operator == (dynamic other)

Returns true if other is a DateTime at the same moment and in the same time zone (UTC or local).

var dDayUtc = new DateTime.utc(1944, 6, 6);
var dDayLocal = dDayUtc.toLocal();

// These two dates are at the same moment, but are in different zones.
assert(dDayUtc != dDayLocal);

See isAtSameMomentAs for a comparison that compares moments in time independently of their zones.

Implementation

bool operator ==(other) {
  if (!(other is DateTime)) return false;
  return (_value == other._value && isUtc == other.isUtc);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-core/DateTime/operator_equals.html