operator == method

  1. @override
bool operator ==(
  1. Object other
)
override
  • If isDeepEquals configuration is true: Will return true only if the list items are equal (and in the same order), and the list configurations are equal. This may be slow for very large lists, since it compares each item, one by one.

  • If isDeepEquals configuration is false: Will return true only if the lists internals are the same instances (comparing by identity). This will be fast even for very large lists, since it doesn't compare each item.

Note: This is not the same as identical(list1, list2) since it doesn't compare the lists themselves, but their internal state. Comparing the internal state is better, because it will return true more often.

Implementation

@override
bool operator ==(Object other) => (other is IList) && isDeepEquals
    ? equalItemsAndConfig(other)
    : (other is IList<T>) && same(other);