dart:io
庫中HttpClientResponse
類的用法介紹如下。
客戶端連接的 HTTP 響應。
HttpClientResponse 對象的主體是來自服務器的 Stream 數據。使用 Stream 方法,例如 Stream.transform 和 Stream.join 來訪問數據。
var client = HttpClient();
try {
HttpClientRequest request = await client.get('localhost', 80, '/file.txt');
HttpClientResponse response = await request.close();
final stringData = await response.transform(utf8.decoder).join();
print(stringData);
} finally {
client.close();
}
相關用法
- Dart HttpClientRequest用法及代碼示例
- Dart HttpClientRequest.followRedirects用法及代碼示例
- Dart HttpClientRequest.abort用法及代碼示例
- Dart HttpClient.findProxy用法及代碼示例
- Dart HttpClient用法及代碼示例
- Dart HttpClient.findProxyFromEnvironment用法及代碼示例
- Dart HttpClient.connectionFactory用法及代碼示例
- Dart HttpClient.keyLog用法及代碼示例
- Dart HttpRequest.postFormData用法及代碼示例
- Dart HttpOverrides用法及代碼示例
- Dart HttpServer.defaultResponseHeaders用法及代碼示例
- Dart HttpRequest.request用法及代碼示例
- Dart HttpDate.parse用法及代碼示例
- Dart HttpRequest用法及代碼示例
- Dart HttpHeaders用法及代碼示例
- Dart HttpServer用法及代碼示例
- Dart HttpRequest.getString用法及代碼示例
- Dart HttpRequest構造函數用法及代碼示例
- Dart HttpResponse用法及代碼示例
- Dart HtmlCollection.last用法及代碼示例
- Dart HtmlEscape用法及代碼示例
- Dart HtmlEscapeMode用法及代碼示例
- Dart HtmlCollection.elementAt用法及代碼示例
- Dart HtmlCollection.length用法及代碼示例
- Dart HtmlDocument.registerElement2用法及代碼示例
注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 HttpClientResponse class。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。