toLocal method Null safety

DateTime toLocal()

Returns this DateTime value in the local time zone.

Returns this if it is already in the local time zone. Otherwise this method is equivalent to:

DateTime.fromMicrosecondsSinceEpoch(microsecondsSinceEpoch,
                                    isUtc: false)

Implementation

DateTime toLocal() {
  if (isUtc) {
    return DateTime._withValue(_value, isUtc: false);
  }
  return this;
}