title: In Flutter how can I return an object after completion of Future in nested async functions?
body: <p>I have a function which calls various other functions that return a Future and after the completion of one Future another method that return a future is called and in the end i need to return a value as a variable but the problem is that function returns NULL instead of the value.</p>
  
  <p><strong>_getLocationPermission()</strong> waits and gets the required permission, i have to wait until I get the permission after getting permission I have to call <strong>_getCurrentLocation()</strong> which will return a Future &lt; LocationData >  and i have to pass this object's data to <strong>getWeatherDetails()</strong> and it will eventually return a Future&lt; String > and i don't know how can i return this string in the return statement. </p>
  
  <pre><code>Future&lt;String&gt; getData() async {
  String longitude, latitude, weatherDetails;
  _getLocationPermission().then((permissionStatus) {
    _getCurrentLocation().then((location) async {
      longitude = location.longitude.toString();
      latitude = location.latitude.toString();
      weatherDetails = await getWeatherDetails(longitude, latitude);
      print(longitude);
    });
  });
  
  return weatherDetails;
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks!</p>