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, {int compare(Comparable a, Comparable b): Comparable.compare}) bool
Returns whether value is in the range from lower to upper. [...]
by(dynamic key(dynamic e), [int compare(Comparable a, Comparable b) = Comparable.compare]) int Function(dynamic a, dynamic b)
Returns a comparator that compares the result of calling key on the items being compared. [...]
clamp(dynamic value, dynamic lower, dynamic upper, {int compare(Comparable a, Comparable b): Comparable.compare}) → dynamic
Clamps value to be in the range from lower to upper. [...]
compound(Iterable<int Function(Comparable a, Comparable b)> comparators) int Function(dynamic a, dynamic b)
Returns a comparator which returns the first non-zero result from comparators, or zero. [...]
isOrdered(Iterable iterable, {int compare(Comparable a, Comparable b): Comparable.compare}) bool
Tests if iterable is in increasing order.
isStrictlyOrdered(Iterable iterable, {int compare(Comparable a, Comparable b): Comparable.compare}) bool
Tests if iterable is in strict increasing order.
lexicographic([int compare(Comparable a, Comparable b) = Comparable.compare]) int Function(Iterable a, Iterable b)
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, {int compare(Comparable a, Comparable b): 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, {int compare(Comparable a, Comparable b): Comparable.compare, dynamic orElse()}) → dynamic
Returns the maximum value in iterable. [...]
min(dynamic a, dynamic b, {int compare(Comparable a, Comparable b): 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, {int compare(Comparable a, Comparable b): Comparable.compare, dynamic orElse()}) → dynamic
Returns the minimum value in iterable. [...]
nullsFirst([int compare(Comparable a, Comparable b) = Comparable.compare]) int Function(dynamic a, dynamic b)
Returns a comparator that orders null values before non-null values. [...]
nullsLast([int compare(Comparable a, Comparable b) = Comparable.compare]) int Function(dynamic a, dynamic b)
Returns a comparator that orders null values after non-null values. [...]
reverse([int compare(Comparable a, Comparable b) = Comparable.compare]) int Function(dynamic a, dynamic b)
Returns a comparator that reverses the order specified by compare. [...]
sorted(Iterable iterable, {int compare(Comparable a, Comparable b): Comparable.compare, bool growable: true}) List
Returns a sorted copy of iterable.