now top-level property

DateTime get now

Gets the current UTC date and time as a DateTime.

This is a convenience getter that combines Date.today() and Time.now() into a single DateTime. The result is always in UTC.

Note: you can mock the current time by setting the nowKey in the Zone to a valid Now function that returns a UTC DateTime.

Example:

final currentTime = now;  // Returns current UTC time
print(currentTime.isUtc);  // true

Implementation

DateTime get now => combineDateAndTime(Date.today(), Time.now());