How does one convert data in API Weather – Sunrise/Sunset in flutter?


How do I convert sunset/sunrise data into time in flutter


How do I convert this data in here: Map setrise = data[‘sys’];

Map setrise = data['sys'];
 int getsunrise = setrise['sunrise'];
  int getsunset = setrise['sunset'];

  //getting timezone
  int getTimezone = data['timezone'];

Where ‘data’ is Map of response of API


Try this code

DateTime.fromMillisecondsSinceEpoch(apisunsettime * 1000),

Answered By – Said Kurt

Answer Checked By – Terry (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *