close listener or listener in HttpRequest
You can add event handlers to the HttpClientConnection and to the response/requests data stream. Like this:
var conn = httpClient.get(host, port, path);conn.onResponse = (HttpClientResponse response) { if(response.statusCode == 200) { StringInputStream stream = new StringInputStream(response.inputStream); StringBuffer body = new StringBuffer(); stream.onData = () => body.add(stream.read()); stream.onClosed = () { // do something when its closed }; }};
I haven't tried this, but the best I can think of is to use the inputStream:
request.inputStread.onClosed((_) => timer.cancel());
I agree with Lars though, even if that works it should be easier to find and more explicit. Might want to file a bug.