worldtime 1.0.1
worldtime: ^1.0.1 copied to clipboard
World Time Plugin
1.0.1 #
A Flutter package to get the time of a specific time zone or geo location. It also includes an easy to use formatter for DateTime with customizable formatting.
Features
1. Get current time from EZ Time Zone
2. Get current time from Latitude and Longitude.
3. Format a Flutter DateTime object to a pretty String formattedtext.
Usage
initiate the plugin
final _worldtimePlugin = Worldtime();
Get the time in Amsterdam.
final DateTime timeAmsterdam = await _worldtimePlugin.timeByCity('Europe/Amsterdam');
Initiate the formatter.
String formatter = 'time - \\H:\\m, date - \\D/\\M/\\Y';
Put the value in a new variable.
final String result = _worldtimePlugin.format(dateTime: timeAmsterdam,
formatter:myFormatter);
Print the variable.
print(result);
Amsterdam's coordinates are 52.3676° N, 4.9041° E => latitude: 52.3676, longitude: 4.9041
Get the time in Amsterdam's coordinates.
final DateTime timeAmsterdamGeo = await _worldtimePlugin.timeByLocation(latitude: 52.
3676, longitude: 4.9041);
We will use the same formatter. ('time - \\H:\\m, date - \\D/\\M/\\Y')
Put the value in a new variable.
final String resultGeo = _worldtimePlugin.format(dateTime: timeAmsterdam,
formatter:myFormatter);
Print the variable.
print(resultGeo);