Created
March 3, 2021 06:01
-
-
Save larryq/864035798573c4eb7fa181096f803dd6 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
Future<List<Clip>> fetchClips() async { | |
List<Clip> clips = []; | |
final response = await http.get( | |
"https://api.songclip.com/songclips/?q=love&shuffle=true&page=1&limit=20&minLength=10&maxLength=300", | |
headers: { | |
HttpHeaders.authorizationHeader: authHeader, | |
"apikey": apikey, | |
}, | |
); | |
final responseJson = jsonDecode(response.body); | |
clips = responseJson['data']['songclips'] | |
.map<Clip>((item) => Clip.fromJson(item)) | |
.toList(); | |
return clips; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment