Time constructor

Time(
  1. int hour, [
  2. int minute = 0,
  3. int second = 0,
  4. int millisecond = 0,
  5. int microsecond = 0,
])

Implementation

Time(this.hour,
    [this.minute = 0,
    this.second = 0,
    this.millisecond = 0,
    this.microsecond = 0]) {
  if (hour < 0 || hour > 24) {
    throw ArgumentError.value(hour, 'hour', 'Not in range: 0..24');
  }

  if (minute < 0 || minute > 59) {
    throw ArgumentError.value(minute, 'minute', 'Not in range: 0..59');
  }

  if (second < 0 || second > 59) {
    throw ArgumentError.value(second, 'second', 'Not in range: 0..59');
  }

  if (millisecond < 0 || millisecond > 1000) {
    throw ArgumentError.value(
        millisecond, 'millisecond', 'Not in range: 0..999');
  }

  if (microsecond < 0 || microsecond > 1000) {
    throw ArgumentError.value(
        microsecond, 'microsecond', 'Not in range: 0..999');
  }
}