closestTo method
The closest element E
to target
.
Example:
[Note.c, Note.e, Note.f.sharp, Note.a].closestTo(Note.g) == Note.f.sharp
Implementation
E closestTo(E target, [num Function(E a, E b)? difference]) =>
_closestTo(target, difference ?? _difference);