parseDuration method

Duration parseDuration(
  1. String s
)

Implementation

Duration parseDuration(String s) {
  int hours = 0;
  int minutes = 0;
  int seconds;
  List<String> parts = s.split(':');
  if (parts.length > 2) {
    hours = int.parse(parts[parts.length - 3]);
  }
  if (parts.length > 1) {
    minutes = int.parse(parts[parts.length - 2]);
  }
  seconds = (double.parse(parts[parts.length - 1].split(",")[0])).round();
  // print("----->$hours $minutes $seconds");
  return Duration(hours: hours, minutes: minutes, seconds: seconds);
}