DateOnly class

Represents a single day.

Implemented types

Constructors

DateOnly(int year, int month, int day)
Constructs a DateOnly from year, month, and day. Throws ArgumentError if components do not represent a valid date.
DateOnly.fromDateTime(DateTime source)
Constructs a DateOnly from DateTime.
DateOnly.fromJson(String json)
Deserializes a string into DateOnly.
factory

Properties

day int
Day of the month (1-indexed).
final
hashCode int
The hash code for this object.
no setteroverride
month int
Month of the year (1-indexed).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
year int
Year of the date.
final

Methods

compareTo(DateOnly other) int
Compares this object to another object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDateTimeLocal() DateTime
Constructs a local DateTime representation of DateOnly.
toDateTimeUtc() DateTime
Constructs a UTC DateTime representation of DateOnly.
toJson() String
Serializes DateOnly into a string.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override