contrast2 library

Utilities for comparing (and contrast2ing) dart values.

Classes

Quantity<T>
A mixin to add comparison operators to classes which implement Comparable.

Functions

between(dynamic value, dynamic lower, dynamic upper, { Comparator<Comparable> compare: Comparable.compare }) → bool
Returns whether value is in the range from lower to upper. [...]
by(dynamic key(dynamic e), [ Comparator<Comparable> compare = Comparable.compare ]) → Comparator
Returns a comparator that compares the result of calling key on the items being compared. [...]
clamp(dynamic value, dynamic lower, dynamic upper, { Comparator<Comparable> compare: Comparable.compare }) → dynamic
Clamps value to be in the range from lower to upper. [...]
compound(Iterable<Comparator<Comparable>> comparators) → Comparator
Returns a comparator which returns the first non-zero result from comparators, or zero. [...]
isOrdered(Iterable iterable, { Comparator<Comparable> compare: Comparable.compare }) → bool
Tests if iterable is in increasing order.
isStrictlyOrdered(Iterable iterable, { Comparator<Comparable> compare: Comparable.compare }) → bool
Tests if iterable is in strict increasing order.
lexicographic([Comparator<Comparable> compare = Comparable.compare ]) → Comparator<Iterable>
Returns a comparator that orders iterables by comparing corresponding elements pairwise until a nonzero result is found. If the end of one iterable is reached, but not the other, the shorter iterable is considered to be less than the longer one. [...]
max(dynamic a, dynamic b, { Comparator<Comparable> compare: Comparable.compare }) → dynamic
Returns the maximum of a and b, according to the order specified by compare. Returns a if compare(a, b) == 0.
maxOf(Iterable iterable, { Comparator<Comparable> compare: Comparable.compare, dynamic orElse() }) → dynamic
Returns the maximum value in iterable. [...]
min(dynamic a, dynamic b, { Comparator<Comparable> compare: Comparable.compare }) → dynamic
Returns the minimum of a and b, according to the order specified by compare. Returns a if compare(a, b) == 0.
minOf(Iterable iterable, { Comparator<Comparable> compare: Comparable.compare, dynamic orElse() }) → dynamic
Returns the minimum value in iterable. [...]
nullsFirst([Comparator<Comparable> compare = Comparable.compare ]) → Comparator
Returns a comparator that orders null values before non-null values. [...]
nullsLast([Comparator<Comparable> compare = Comparable.compare ]) → Comparator
Returns a comparator that orders null values after non-null values. [...]
reverse([Comparator<Comparable> compare = Comparable.compare ]) → Comparator
Returns a comparator that reverses the order specified by compare. [...]
sorted(Iterable iterable, { Comparator<Comparable> compare: Comparable.compare, bool growable: true }) → List
Returns a sorted copy of iterable.