operator == method

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

compare two arrays

Examples

var n = Array([1, 2, 3]);
var n2 = Array([1, 2, 3]);

print(n == n2);

/* output:
true
*/

Implementation

@override
bool operator ==(b) {
  if (b is Array) {
    _checkArray(b);
    for (var i = 0; i < length; i++) {
      if (this[i] != b[i]) {
        return false;
      }
    }
    return true;
  } else {
    throw ('the right object has to be an Array type');
  }
}