如何打开url并获取数据.
这是代码:
void main() {
runApp(MaterialApp(
home: new Scaffold(
body: new Center(
child: new ElevatedButton(
onPressed: () {
//_launchInBrowser(Uri(scheme: 'https', host: "dart.dev"));
var data = html.window.open("https://dart.dev", "dart dev");
print(data.location);
},
child: new Text('Show Flutter homepage'),
),
),
),
));
}
Future<void> _launchInBrowser(Uri url) async {
if (!await launchUrl(
url,
mode: LaunchMode.externalApplication,
)) {
throw 'Could not launch $url';
}
}