convertTimeTo24Hour function

List<int> convertTimeTo24Hour(
  1. String time
)

Implementation

List<int> convertTimeTo24Hour(String time) {
  List<int> timeList = [];
  if (time.contains('AM')) {
    time = time.replaceAll('AM', '');
    timeList = time.split(':').map((e) => int.parse(e)).toList();
  } else {
    time = time.replaceAll('PM', '');
    timeList = time.split(':').map((e) => int.parse(e)).toList();
    timeList[0] = timeList[0] + 12;
  }
  return timeList;
}