time constructor

time(
  1. {String str,
  2. bool isMilitary: true}
)

Implementation

time({this.str, this.isMilitary = true}) {
  // default constructor
  int first = str.indexOf(":");
  int second = str.lastIndexOf(":");
  this.hour = int.parse(str.substring(0, first));
  this.minute = int.parse(str.substring(first + 1, second));
  this.second = int.parse(str.substring(second + 1));
}