I have a DateTime object that has been formatted to a string to show only the time. What should I do so that the time auto-updates. Any help would be really appreciated.
Widget build(BuildContext context) {
String formattedTime = DateFormat('kk:mm').format(DateTime.now());
String hour = DateFormat('a').format(DateTime.now());
return Scaffold(
body: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
child: Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(formattedTime,
style: GoogleFonts.lato(
fontSize: 80.0,
color: Colors.blue,
fontStyle: FontStyle.normal,
letterSpacing: 5.0)),
Padding(
padding: const EdgeInsets.only(top: 41.0, left: 10.0),
child: Text(
hour,
style: GoogleFonts.lato(
color: Colors.blue,
fontSize: 30.0,
),
),
),
],
),
),
),
],
),
);
}