flutter_timezone_name 0.0.7 copy "flutter_timezone_name: ^0.0.7" to clipboard
flutter_timezone_name: ^0.0.7 copied to clipboard

flutter_timezone_name is basically an improved timezone package so you can just use as an getCurrentTimeZoneName method.

example/lib/main.dart

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

///  this is a example of flutter package to add flutter_timezone_name in any widget for Android and IOS
void main() {
  runApp(const MyApp());
}

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

  /// This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'flutter_timezone_name demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const HomeScreen(),
    );
  }
}

/// root page of out application
class HomeScreen extends StatefulWidget {
  const HomeScreen({Key? key}) : super(key: key);

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  String currentTimezoneName = "";

  @override

  /// init method of this widget
  void initState() {
    super.initState();
    _getCurrentTimeZoneName();
  }

  /// method _getCurrentTimeZoneName helps to get current timezone name
  _getCurrentTimeZoneName() {
    currentTimezoneName = TimeZone.getCurrentTimeZoneName();
    _setState();
  }

  /// setState wrapper
  _setState() {
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        /// here it's your current timezone name
        child: Text(currentTimezoneName.toString()),
      ),
    );
  }
}
5
likes
160
points
45
downloads

Publisher

verified publisherwhiteorangesoftware.com

Weekly Downloads

flutter_timezone_name is basically an improved timezone package so you can just use as an getCurrentTimeZoneName method.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on flutter_timezone_name