my_timezone 0.0.3 copy "my_timezone: ^0.0.3" to clipboard
my_timezone: ^0.0.3 copied to clipboard

A flutter plugin for getting the local timezone of the device on Android, ios, macos.

codecov GitHub Buy Me A Coffee PayPal Sponsor Support Me on Ko-fi

my_timezone is a Flutter plugin that returns the local timezone and available timezones on Android, iOS, macOS, and web.

Features #

  • Get the local timezone from the native layer.
  • Get the list of available timezones.
  • Works across Android, iOS, macOS, and web.

Installation #

Add the following to your pubspec.yaml:

my_timezone: ^0.0.1+4

Then run:

flutter pub get

Basic usage #

import 'package:my_timezone/my_timezone.dart';

final String localTimezone = await MyTimezone.getLocalTimezone();
final List<String> availableTimezones =
    await MyTimezone.getAvailableTimezones();

Example in a widget #

class _MyAppState extends State<MyApp> {
  String? _timezone;

  @override
  void initState() {
    super.initState();
    _loadTimezone();
  }

  Future<void> _loadTimezone() async {
    final timezone = await MyTimezone.getLocalTimezone();
    if (!mounted) return;
    setState(() => _timezone = timezone);
  }
}

Contribution #

If you have any suggestions or find any issues, feel free to open an issue or submit a pull request on GitHub.

Developer Team: #

Any comments please contact us ThaoDoan and DucNguyen.

2
likes
160
points
154
downloads
screenshot

Publisher

verified publisherwongcoupon.com

Weekly Downloads

A flutter plugin for getting the local timezone of the device on Android, ios, macos.

Repository (GitHub)
View/report issues

Topics

#timezone #local-time #device-info #flutter-plugin #cross-platform

Documentation

API reference

Funding

Consider supporting this project:

buymeacoffee.com
ko-fi.com
github.com
paypal.me

License

MIT (license)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on my_timezone

Packages that implement my_timezone