-
Refactor the Clima app's code so that all the logic of getting the current location will be handled by a dedicated
Locationobject. -
Creating a seperate
Locationclass in the location.dart file. -
This class needs to have two properties: a
latitudeand alongitude. -
The
Locationclass also needs to have a method calledgetCurrentLocation(). Move the try-catch block with the code where yougetCurrentPosition()in the loading_screen to thegetCurrentLocation()method. -
In the loading_screen.dart update
getLocation()so that you 1) create a newLocationobject, 2) you call thegetCurrentLocation()method, and 3) you print the values stored insidelatitudeandlongitude.
Hint: Assign the values to your latitude and longitude properties using position.latitude and position.longitude.