closestTo method
The closest element E
to target
.
Example:
const [2, 5, 6, 8, 10].closestTo(7) == 6
Implementation
E closestTo(E target, [num Function(E a, E b) difference = _difference]) =>
_closestTo(target, difference);
The closest element E
to target
.
Example:
const [2, 5, 6, 8, 10].closestTo(7) == 6
E closestTo(E target, [num Function(E a, E b) difference = _difference]) =>
_closestTo(target, difference);