This is what I have so far. The getPlaces is an http get request that returns a dict. I just need the dict info in a string so I can parse it. I know that I have to use the .then() method but it isn't working when I try to set an external variable equal to the value of the .then method
List<Widget> makeItems(
String query,
) {
Future<List> placesList = getPlaces(query);
var thingString = placesList.then((value) => print(value)).toString();
print('thingstring: ' + thingString);
var widgetList = [Text('yas')];
// for (int i = 1; i < placesList.toString().length; i++) {
// widgetList.add(Text(placesList[i]));
// }
return widgetList;
}
Future<List> getPlaces(String query) async {
Dio _dio = Dio();
var queryParameters = {'search_query': query};
var data = await _dio.get('http://127.0.0.1:5000/getPlaces/',
queryParameters: queryParameters);
String fullString = data.data.toString();
print('fullstring: ' + fullString);
var listylist = [];
listylist = fullString.split(', (');
return listylist;
}