getDatesBetween static method
Implementation
static List<DateTime> getDatesBetween(DateTime date1, DateTime date2, {bool inclusive = true}){
var smallerDate = date1.millisecondsSinceEpoch < date2.millisecondsSinceEpoch ? date1 : date2;
var largerDate = date2.millisecondsSinceEpoch > date1.millisecondsSinceEpoch ? date2 : date1;
final dates = <DateTime>[];
while (!smallerDate.isAfter(largerDate)) {
dates.add(smallerDate);
smallerDate = DateTime.fromMillisecondsSinceEpoch(smallerDate.millisecondsSinceEpoch + Duration(days: 1).inMilliseconds);
}
if(!inclusive){
if(dates.length > 0) {
dates.removeAt(0);
}
if(dates.length > 0) {
dates.removeLast();
}
}
return dates;
}