LocalDate.now constructor
LocalDate.now()
Returns the current date as a LocalDate.
Example:
final today = LocalDate.now();
Represents a calendar date without time or timezone.
This class provides date-only operations such as computing weekdays, adding or subtracting days/months/years, and converting from/to strings.
It ensures valid dates (e.g. February never has more than 29 days).
Example
final date = LocalDate(2024, 6, 27);
print(date); // "2024-06-27"
Implementation
factory LocalDate.now() {
final now = DateTime.now();
return LocalDate(now.year, now.month, now.day);
}