toUtc abstract method

TimeRange toUtc()

Unless you're using CustomTimeRange, this will always keep the properties like year, month the same.

TL;DR, the following is NOT same.

  • TimeRange().toUtc().from != TimeRange().from.toUtc()
  • TimeRange().toUtc().to != TimeRange().to.toUtc()

For example,

final yearRange = YearTimeRange(2022);

print(yearRange.from.year); // 2022
print(yearRagne.toUtc().from.year); // 2022

But as DateTime(2022, DateTime.january, 1) can be in the year 2021 in certain timezones.

print(yearRange.from.toUtc().year); // Depending on the time zone, 2021 or 2022

Implementation

TimeRange toUtc();