title: Flutter - Openweathermap api call error - Passing parameter to api call doesn't work
body: <p>Location class is the responsible for getting the longitude and latitude. 
  getData() method from the Loading_screen class is the responsible for calling the api to get weather data. The problem is when I pass the longitude and latitude values to the url of api, it returned error 400. 
  Workaround is to hardcode the longitude and latitude and it successfully retrieved api data. I can't figure why passing longitude and latitude values to api call doesn't work</p>
  
  <p>Location</p>
  
  <pre><code>import 'package:geolocator/geolocator.dart';
  import 'package:http/http.dart' as http;
  
  class Location{
    double longitude;
    double latitude;
  
    Future&lt;void&gt; getCurrentLocation() async{
      try{
        Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
        longitude = position.longitude;
        latitude = position.latitude;
        print('Longitude: $longitude \n' +
              'Latitude: $latitude');
      }catch(e){
        print(e);
      }
    }
  }
  </code></pre>
  
  <p>Loading_screen class</p>
  
  <pre><code>import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  import 'package:clima/location.dart';
  import 'package:http/http.dart' as http;
  import 'dart:convert';
  
  class LoadingScreen extends StatefulWidget {
    @override
    _LoadingScreenState createState() =&gt; _LoadingScreenState();
  }
  
  class _LoadingScreenState extends State&lt;LoadingScreen&gt; {
  
    var apiKey = 'secret';
    double lat, lon;
    @override
    void initState() {
      getLocation();
    }
  
    void getData() async{
  
      var url = 'http://api.openweathermap.org/data/2.5/weather?lat=${lat}&amp;${lon}&amp;appid=$apiKey';
      //var url = 'http://api.openweathermap.org/data/2.5/weather?lat=14.6102473&amp;121.0043158&amp;appid=secret';
      //var url = 'http://api.openweathermap.org/data/2.5/weather?lat=14.6102473&amp;lon=121.0043158&amp;appid=secret';
  
  
      var request = await http.get(url);
      if(request.statusCode == 200){
        String data = request.body.toString();
        var city = jsonDecode(data)['name'];
        var description = jsonDecode(data)['weather'][0]['description'];
        print('Welcome to $city city!');
        print('Weather: $description');
      }else{
        print(request.statusCode);
        print('Latitude is: $lat *** Longitude is: $lon'); // this prints longitude and latitude values 
        print('request $url'); // when I entered the url in postman, I'm getting the same error 400
      }
    }
  
    void getLocation() async{
      Location location = new Location();
      await location.getCurrentLocation();
      lat = location.latitude;
      lon = location.longitude;
      getData();
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold();
    }
  }
  </code></pre>