operator == method

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

The equality operator.

Two ColorRefs are equal if they have the same defaultColor and id. Please note, the current color (that depends on the current theme) is ignored.

If you want to check equality for the ColorRef's current color, you can use its color or value getters. For example:

  • ColorRef(Colors.white).color == ColorRef(Colors.white).color // Is true
  • ColorRef(Colors.white).color == Colors.white // Is true
  • ColorRef(Colors.white) == Colors.white // Is false

Implementation

@override
bool operator ==(Object other) =>
    identical(this, other) ||
    super == other &&
        other is ColorRef &&
        runtimeType == other.runtimeType &&
        id == other.id &&
        defaultColor == other.defaultColor;