update method

DateTime? update(
  1. String key,
  2. int value
)

Update Date

Implementation

DateTime? update(String key, int value) {
  switch (key) {
    case "minute":
      return DateTime(this.year, this.month, this.day, this.hour, value);
    case "hour":
      return DateTime(this.year, this.month, this.day, value, this.minute);
    case "day":
      return DateTime(this.year, this.month, value, this.hour, this.minute);
    case "month":
      return DateTime(this.year, value, this.day, this.hour, this.minute);
    case "year":
      return DateTime(value, this.month, this.day, this.hour, this.minute);
    default:
      return null;
  }
}