equals method

  1. @override
bool equals(
  1. SelfEncoder e1,
  2. SelfEncoder e2
)
override

Compare two elements for being equal.

This should be a proper equality relation.

Implementation

@override
bool equals(SelfEncoder e1, SelfEncoder e2) {
  final bytes = e1.toImmutableBytes();
  final otherBytes = e2.toImmutableBytes();
  if (bytes.length != otherBytes.length) {
    return false;
  }
  for (var i = 0; i < bytes.length; i++) {
    if (bytes[i] != otherBytes[i]) {
      return false;
    }
  }
  return true;
}