guessZoneId function

ZoneId guessZoneId()

Obtains an identifier string for the current time zone.

There is no way to obtain an actual time zone ID in Dart. The obtained value if platform dependant and usually human readable.

See https://github.com/dart-lang/sdk/issues/21758

Implementation

ZoneId guessZoneId() {
    var dateTime = DateTime.now();
    var zoneName = dateTime.timeZoneName;
    var zoneId = ZoneId();
    zoneId.value = zoneName;
    return zoneId;
}