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 ==(Object b) {
  if (b is! Array || b.length != length) {
    return false;
  }
  for (var i = 0; i < length; i++) {
    if (this[i] != b[i]) {
      return false;
    }
  }
  return true;
}