timeToSeconds function

int timeToSeconds(
  1. String time
)

Implementation

int timeToSeconds(String time) {
  Iterable<int> values = time.split(":").map((e) => e as int);

  final hours = values.elementAt(0);
  final minutes = values.elementAt(1);
  final seconds = values.elementAt(2);

  return hours * 60 * 60 + minutes * 60 + seconds;
}