**So I am trying to get Africa/Nairobi's time because my app needs a country's exact time to work, and if the user's device is 2 minutes infront or behind, it won't work. I personally needs the exact time for my API's timestamp.
So I tried to use this package but it still prints out the device time instead of the timezone's time. Why is that?
timezonetesting() {
loadDefaultData().then((rawData) {
initializeDatabase(rawData);
var africa = getLocation('Africa/Nairobi');
// var now = tz.TZDateTime.now(africa);
var now = tz.TZDateTime.now(africa);
// var now1 = tz.TZDateTime.local();
// var now = tz.TZDateTime.now(africa);
**So I am trying to get Africa/Nairobi's time because my app needs a country's exact time to work, and if the user's device is 2 minutes infront or behind, it won't work. I personally needs the exact time for my API's timestamp.
So I tried to use this package but it still prints out the device time instead of the timezone's time. Why is that?
Below are the functions that I am using :**
Future<List> loadDefaultData() async {
var byteData = await rootBundle.load('packages/timezone/data/2020a.tzf');
return byteData.buffer.asUint8List();
}
timezonetesting() { loadDefaultData().then((rawData) { initializeDatabase(rawData); var africa = getLocation('Africa/Nairobi'); // var now = tz.TZDateTime.now(africa); var now = tz.TZDateTime.now(africa); // var now1 = tz.TZDateTime.local(); // var now = tz.TZDateTime.now(africa);
}