I am trying to convert the response from api to string in flutter. I am still a beginner to Flutter so I'm sorry about that. Whenever I do the get and assign it to a variable, the value is always 'Instance of Future' rather than the actual text? So does this mean I have to convert it to text? This is the code that I used.
gethttps() async{
var response = await http.get(url);
print("JSON" + response.body);
String data = response.body;
data = json.decode(response.body.toString());
return data;
}
CALL FROM OUTSIDE THE FUNCTION
var response = gethttps();