Danny Tuppeny
2016-08-13 10:24:39 UTC
(Also on SO if that's your thing <http://stackoverflow.com/q/38931710/25124>
)
This simple dart app seems to wait approx 5 seconds after the last line of
main before terminating. I'm writing the response to the screen, so it's
not that my async request is still ongoing.
Any ideas what's going on?
import 'dart:io';import 'dart:async';import 'dart:convert';
Future<String> _sendRequest() async {
var http = new HttpClient();
return http
.postUrl(Uri.parse("https://www.google.com/404"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
return response.transform(UTF8.decoder).join("");
});}
main(List<String> args) async {
print("starting...");
print(await _sendRequest());
print("finished");}
)
This simple dart app seems to wait approx 5 seconds after the last line of
main before terminating. I'm writing the response to the screen, so it's
not that my async request is still ongoing.
Any ideas what's going on?
import 'dart:io';import 'dart:async';import 'dart:convert';
Future<String> _sendRequest() async {
var http = new HttpClient();
return http
.postUrl(Uri.parse("https://www.google.com/404"))
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
return response.transform(UTF8.decoder).join("");
});}
main(List<String> args) async {
print("starting...");
print(await _sendRequest());
print("finished");}
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.