2013-06-27 192 views

回答

2

刺,但會connectionInfonull意味着HttpResponse已經完成?

否則,我想你可以在done返回的Future中設置一個「closed」布爾變量,並測試它在處理響應之前是否被設置?

HttpResponse response = ...; 
bool closed = false; 
response.done.then((_) => closed = true); 

if (!closed) { 
    ... 
} 

但我不確定您是否能夠儘早做到這一點,取決於場景。

相關問題