closestTo method
Get closest day to current one, returns null if empty Iterable is passed as argument
Implementation
DateTime? closestTo(Iterable<DateTime> datesArray) {
if (datesArray.isEmpty) {
return null;
}
final index = closestIndexTo(datesArray);
if (index == null) {
return null;
}
return datesArray.elementAt(index);
}