at method

date at({
  1. int? year,
  2. int? month,
  3. int? day,
  4. int? hour,
  5. int? minute,
  6. int? second,
  7. int? millisecond,
  8. int? microsecond,
})

Returns a DateTime object representing the specified date and time.

The optional parameters allow you to specify the year, month, day, hour, minute, second, millisecond, and microsecond. If any of the parameters are not provided, the current value of that component will be used.

Example usage:

var myDate = at(year: 2022, month: 10, day: 31, hour: 12, minute: 0, second: 0);
print(myDate); // Output: 2022-10-31 12:00:00.000

Implementation

date at({int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond}) {
  return DateTime(
    year ?? this.year,
    month ?? this.month,
    day ?? this.day,
    hour ?? this.hour,
    minute ?? this.minute,
    second ?? this.second,
    millisecond ?? this.millisecond,
    microsecond ?? this.microsecond,
  );
}