Created
May 18, 2020 16:27
-
-
Save theindianappguy/7a5d499b45199eea6b20240e11aacf7b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| getSearchWallpaper(String searchQuery) async { | |
| await http.get( | |
| "https://api.pexels.com/v1/search?query=$searchQuery&per_page=30&page=1", | |
| headers: {"Authorization": apiKEY}).then((value) { | |
| //print(value.body); | |
| Map<String, dynamic> jsonData = jsonDecode(value.body); | |
| jsonData["photos"].forEach((element) { | |
| //print(element); | |
| PhotosModel photosModel = new PhotosModel(); | |
| photosModel = PhotosModel.fromMap(element); | |
| photos.add(photosModel); | |
| //print(photosModel.toString()+ " "+ photosModel.src.portrait); | |
| }); | |
| setState(() {}); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment