I want to set a different country time to AnalogClock(https://pub.dev/packages/flutter_analog_clock) using the timezone library (https://pub.dev/packages/timezone) in flutter. I tried the below method but this did not work.
This the code i tried
@override
void initState() {
super.initState();
timer = Timer.periodic(Duration(seconds: 1), (Timer t) => setupWorldTime());
createRandomDoubleNumber();
}
setupWorldTime() {
final detroit = getLocation('America/Detroit');
final us = getLocation('US/Pacific');
final tokyo = getLocation('Asia/Tokyo');
setState(() {
nowDetroit = new TZDateTime.now(detroit);
nowUs = new TZDateTime.now(us);
nowTokyo = TZDateTime.now(tokyo);
// print('${nowDetroit.hour}:${nowDetroit.minute}:${nowDetroit.second}');
// fm= DateFormat.yMMMMEEEEd().format(nowDetroit);
// print('us $nowDetroit');
print('he ${DateTime.now()}');
print('he ${nowDetroit}');
});
}
below the widget
child: AnalogClock(
datetime: nowUs ,
textScaleFactor: 1.8,
showAllNumbers: true,
decoration: BoxDecoration(
border: Border.all(
width: 2.0,
color: Colors.black),
color: Colors.transparent,
shape: BoxShape.circle),
),
