1. plugin apis
  2. timezone

TimeZone

Documentation for the TimeZone API for spotube plugins

The TimeZone API provides access to the current time zone of the device running Spotube. This can be useful for plugins that need to display or handle time-related information based on the user’s local time zone.

To use the TimeZone API, you can import the spotube_plugin module and access the TimeZone class.

import "module:spotube_plugin" as spotube

var TimeZone = spotube.TimeZone

To get current local time zone for the device, you can use the getLocalTimeZone method:

TimeZone.getLocalTimeZone().then((timeZone) {
    print("Current local time zone: $timeZone") // e.g., "America/New_York"
})

To get all available time zones, you can use the getAvailableTimeZones method:

TimeZone.getAvailableTimeZones().then((timeZones) {
    for (var tz in timeZones) {
        print("Available time zone: $tz") // e.g., "America/New_York", "Europe/London", etc.
    }
})