Dart does not provide a tz timezone for the platform directly, however one can use the following two properties and a mapping to determine the tz timezone.
(1) The DateTime.now().timeZoneName property gives a timezone abbreviation (on Windows it gives a full name). This abbreviation alone is not enough to determine a time zone. For example, CST can mean Central Standard Time, Cuba Standard Time, China Standard Time, etc.
(2) The DateTime.now().timeZoneOffset property gives a UTC offset, which vertical spans multiple timezones. This alone is not enough to determine a timezone.
To determine the tz timezone, use both the DateTime.now().timeZoneName and DateTime.now().timeZoneOffset properties, and map to the appropriate tz timezone.
Example below (which could be created as a Flutter package):
String timeZone = DateTime.now().timeZoneName.toString();
String timeZoneOffset = DateTime.now().timeZoneOffset.toString();
String tzTimeZoneName = '';
String timeZoneName = '';
if (
(timeZone == 'CST' || timeZone == 'CST ( Central Standard Time )') &&
timeZoneOffset == '-6:00:00.00-0.0'
) {
tzTimeZoneName = 'America/Chicago';
timeZoneName = 'Central Standard Time';
}
These two pages can be used to create a full mapping:
https://en.wikipedia.org/wiki/List_of_time_zone_abbreviations
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
Note: This mapping technique can also be used to convert the timezone abbreviation into the full name timezone (on non-Window systems). For example CST, to "Central Standard Time". I also think the Dart team, could have patched this on non-Window systems, as they have both the timezone abbreviation and the UTC offset. ♂️