NumberUtils class abstract final

Numeric helpers: math, normalization and aggregation.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

average(Iterable<num> values) → double
Average of values. Returns 0 for an empty collection.
clamp(num value, num min, num max) → num
Clamps value between min and max.
clamp01(double value) → double
Clamps value between 0 and 1.
mapRange(num value, num inMin, num inMax, num outMin, num outMax) → num
Re-maps value from one range to another.
max(Iterable<num> values) → num?
Largest value, or null when values is empty.
min(Iterable<num> values) → num?
Smallest value, or null when values is empty.
normalize(num value, num min, num max) → double
Normalizes value in the range min–max to 0.0–1.0.
perceTage(num value, num total) → double
value as a perceTage of total (0–100). Returns 0 when total is 0.
pow10(int places) → double
range(Iterable<num> values) → num
Difference between the largest and smallest value. Returns 0 when empty.
roundTo(num value, int places) → double
Rounds value to places decimal places.
sum(Iterable<num> values) → num
Sum of values.