toDateTime method

DateTime toDateTime({
  1. bool local = false,
})

Creates a DateTime object with the current date, at midnight.

The default is to create a UTC DateTime. If local is true, the created DateTime is local time. Be aware that some locations switch daylight saving time at midnight.

Implementation

DateTime toDateTime({bool local = false}) => local
    ? DateTime(year, month, day)
    : DateTime.fromMillisecondsSinceEpoch(
        _daysSinceEpoch * Duration.millisecondsPerDay,
      );