1

I've got the following future method which fetches a string from a PHP/Mysql database.

Future<String> getCount({ String audioid,}) async {
  final String pass = "";
  String  upDateUrl = "http://example.com;
  final response = await get(upDateUrl);
  if (response.statusCode == 200) {
    return response.body;
  }
  print(response.body);
}

Then I've got this variable at the top line of my build;

 var replycount = getCount(audioid: speakcraft.audioid);

When I try to access the String in a Text Widget;

Text(replycount.toString(),

I get this instead of the String I need;

Instance of 'Future<String>'

How do I get my database result as a String?

nvoigt
  • 75,013
  • 26
  • 93
  • 142
Meggy
  • 1,491
  • 3
  • 28
  • 63

0 Answers0