getMinutesFromMidnight static method

int getMinutesFromMidnight(
  1. DateTime time
)

Helper function to get the number of minutes from midnight.

Useful for passing a schedule to the scheduling functions. Returns the number of minutes from midnight of the day of the DateTime object.

Implementation

static int getMinutesFromMidnight(DateTime time) {
  final dayStart = DateTime(time.year, time.month, time.day);
  final dur = time.difference(dayStart);
  return dur.inMinutes;
}