tomorrow static method

DateTime tomorrow({
  1. DateTime? now,
  2. int? hour,
  3. int? minute = 0,
  4. int? second = 0,
})

Returns the date for tomorrow at the specified time.

Args: now (DateTime?): The current date and time. Defaults to null (uses the actual current date and time). hour (int?): The hour for tomorrow's date. Defaults to 0. minute (int?): The minute for tomorrow's date. Defaults to 0. second (int?): The second for tomorrow's date. Defaults to 0.

Returns: DateTime: The date for tomorrow at the specified time.

Implementation

static DateTime tomorrow({DateTime? now, int? hour, int? minute = 0, int? second = 0}) {
  // Get the current date and time
  now ??= DateTime.now();

  // Calculate the date for tomorrow at the specified time
  final DateTime tomorrowAtSpecifiedTime = now.addDays(1);

  return tomorrowAtSpecifiedTime.copyWith(
    hour: hour ?? 0,
    minute: minute ?? 0,
    second: second ?? 0,
    microsecond: 0,
  );
}