gmt 0.2.0 copy "gmt: ^0.2.0" to clipboard
gmt: ^0.2.0 copied to clipboard

outdated

Get current datetime in GMT from internet (example.com or google.com) and return DateTime in UTC.

GMT #

Get current DateTime in GMT from the internet (example.com or google.com) and return DateTime in UTC.

This package provides an easy way to get the current DateTime in UTC from the internet. It will get DateTime from the headers of https://example.com as primary and https://google.com if the primary gives error. On web platform, the package will use headers from current URL to avoid CORS error.

Usage:

var now = await GMT.now();

If you want to get local DateTime if it gives error or timeout then using (default is return null):

var now = await GMT.now(returnLocalIfError: true); // Default is false

You can also set a timeout for it by using:

var now = await GMT.now(returnLocalIfError: true, timeout: const Duration(seconds: 5)); // Default is false
1
likes
0
pub points
71%
popularity

Publisher

verified publisherlamnhan.dev

Get current datetime in GMT from internet (example.com or google.com) and return DateTime in UTC.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

http, universal_io

More

Packages that depend on gmt