endsWith method
Returns true if this iterable ends with the same elements that are in
other
.
Implementation
bool endsWith(
Iterable<T> other, {
bool Function(T value, T otherValue) comparer,
}) {
checkNullError(this);
if (other == null) {
throw ArgumentError.notNull('other');
}
comparer ??= EqualityComparer.forType<T>().compare ?? (a, b) => a == b;
final count = other.count();
final tail = takeLast(count);
return tail.sequenceEquals(other, comparer: comparer);
}