getCurrentTime function

Map<String, Object> getCurrentTime({
  1. required String city,
})

Returns a serialized current-time payload for city.

Implementation

Map<String, Object> getCurrentTime({required String city}) {
  final DateTime now = DateTime.now();
  return <String, Object>{
    'status': 'success',
    'city': city,
    'time': now.toIso8601String(),
  };
}