time_zone_plus 0.0.4 copy "time_zone_plus: ^0.0.4" to clipboard
time_zone_plus: ^0.0.4 copied to clipboard

A Flutter package to get timezone names and country codes from UTC offsets. Supports multiple timezones per offset.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:time_zone_plus/time_zone_plus.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    final now = DateTime.now();
    final offset = now.timeZoneOffset.inMinutes;

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('TimeZonePlus Example')),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text(
                  'Current UTC Offset: ${offset >= 0 ? '+' : ''}${offset ~/ 60}:${offset % 60}'),
              const SizedBox(height: 20),
              Text('Possible Timezones: ${TimeZonePlus.getCurrentTimeZones()}'),
              const SizedBox(height: 20),
              Text('Selected Timezone: ${TimeZonePlus.getCurrentTimeZone()}'),
              const SizedBox(height: 20),
              Text('Country Code: ${TimeZonePlus.getCurrentCountryCode()}'),
            ],
          ),
        ),
      ),
    );
  }
}
6
likes
160
points
10
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package to get timezone names and country codes from UTC offsets. Supports multiple timezones per offset.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on time_zone_plus