I'm consistently receiving multi-threading issues when downloading a list of gifs from giphy.com. Each time my app crashes and logs a "I/Choreographer(15955): Skipped 104 frames! The application may be doing too much work on its main thread." type error. I haven't come across any threading solutions for flutter. Here is my code...
Future<Null> giphy() async {
var _searchterm = _searchController.text.toString().replaceAll(' ', '+');
String url = GIPHY.com;
//var httpClient = createHttpClient();
var response = await http.get(url);
Map data = json.decode(response.body);
//print(data['data']);
var gifs = new List();
for (var items in data['data']) {
var images = (items['images'] as Map);
var downsized = (images['downsized'] as Map);
var urls = downsized['url'].toString();
gifs.add(urls);
}
setState(() => giphyUrls = gifs);
_neverSatisfied();
}
giphyUrls
is a public list that feeds into a gridview builder.