parseDurationStr2Seconds static method

int parseDurationStr2Seconds(
  1. String str
)

Implementation

static int parseDurationStr2Seconds(String str) {
  final datalist = str.split(':');
  int renum = 0;
  int level = 1;
  for (int i = datalist.length; i-- > 0;) {
    final item = int.tryParse(datalist[i]);
    if (null != item) {
      renum += item * level;
    }
    level *= 60;
  }
  return renum;
}