httpTelemetryPost function
TelemetryPost
httpTelemetryPost({
- Client? client,
- Duration timeout = const Duration(seconds: 15),
package:http 기반 TelemetryPost — 익명 집계 업로드(9.3).
관리 플레인으로 가는 유일한 쓰기 경로이고, 실패해도 화면의 번역은 영향을 받지 않는다.
Implementation
TelemetryPost httpTelemetryPost({
http.Client? client,
Duration timeout = const Duration(seconds: 15),
}) {
final c = client ?? http.Client();
return (String url, String body) async {
final response = await c
.post(Uri.parse(url), headers: {'content-type': 'application/json'}, body: body)
.timeout(timeout);
return response.statusCode;
};
}