static int toInt(String str) { final arr = str.split(':'); var sum = 0; for (var i = 0; i < arr.length; i++) { sum += int.parse(arr[i]) * (pow(60, arr.length - i - 1) as int); } return sum; }