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
  • 68,786
  • 25
  • 88
  • 134
Meggy
  • 1,269
  • 1
  • 15
  • 41

0 Answers0