operator == method Null safety

  1. @override
bool operator ==(
  1. dynamic other
)
override

Returns true if other is a TZDateTime at the same moment and in the same Location.

final detroit   = getLocation('America/Detroit');
final dDayUtc   = TZDateTime.utc(1944, DateTime.JUNE, 6);
final dDayLocal = TZDateTime(detroit, 1944, DateTime.JUNE, 6);

assert(dDayUtc.isAtSameMomentAs(dDayLocal) == false);

See isAtSameMomentAs for a comparison that adjusts for time zone.

Implementation

@override
bool operator ==(dynamic other) {
  return identical(this, other) ||
      other is TZDateTime &&
          _native.isAtSameMomentAs(other._native) &&
          location == other.location;
}