nowLocal top-level property

DateTime get nowLocal

Gets the current local date and time as a DateTime.

This is a convenience getter that returns the current UTC time converted to local time. Note that this converts from UTC to local time, so the date might change depending on the timezone offset.

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 localTime = nowLocal;  // Returns UTC time converted to local
print(localTime.isUtc);  // false

Implementation

DateTime get nowLocal => now.toLocal();