W3cubDocs

/Dart 2

operator == method

bool operator == (Object other)

Test whether another object is equal to this function.

System-created function objects are only equal to other functions.

Two function objects are known to represent the same function if

  • It is the same object. Static and top-level functions are compile time constants when used as values, so referring to the same function twice always give the same object,
  • or if they refer to the same member method extracted from the same object. Extracting a member method as a function value twice gives equal, but not necessarily identical, function values.

Function expressions never give rise to equal function objects. Each time a function expression is evaluated, it creates a new closure value that is not known to be equal to other closures created by the same expression.

Classes implementing Function by having a call method should have their own operator== and hashCode depending on the object.

Implementation

bool operator ==(Object other);

© 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/Function/operator_equals.html