Last active
April 22, 2019 11:24
-
-
Save fengyfei/ea90809a75a9db949ca4f03a8967151d to your computer and use it in GitHub Desktop.
HttpRequest.getString Sample
This file contains 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
// https://github.com/npm/download-counts | |
import 'dart:html'; | |
const npmDownloadBase = 'https://api.npmjs.org/downloads/point/'; | |
void fetchDownloadCounts({String repo='koa', String period='last-week'}) async { | |
var resp = await HttpRequest.getString('$npmDownloadBase${period}/$repo'); | |
print(resp); | |
} | |
void main() { | |
fetchDownloadCounts(repo: 'express'); | |
fetchDownloadCounts(repo: 'koa'); | |
fetchDownloadCounts(repo: 'sails'); | |
fetchDownloadCounts(repo: 'hapi'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment