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
final myFuture = http.get(""https://example.com); | |
// 许多的Dart异步API都是返回的Futures. |
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
RaisedButton( | |
onPressed: () { | |
final myFuture = http.get('https://my.image.url'); | |
myFuture.then((resp) { | |
setImage(resp); | |
}); | |
}, | |
child: Text('Click me!'), | |
) |