read static method
Implementation
static Future<String?> read(
Uri url, {
Map<String, String>? headers,
CancellationToken? cancelToken,
int retries = 3,
Duration? timeLimit,
Duration timeRetry = const Duration(milliseconds: 100),
FutureOr<String> Function()? onTimeout,
}) async {
cancelToken?.throwIfCancellationRequested();
return await RetryHelper.tryRun<String>(
() {
return CancellationTokenSource.register(
cancelToken,
timeLimit == null
? _httpClient.read(
url,
headers: headers,
)
: _httpClient
.read(
url,
headers: headers,
)
.timeout(
timeLimit,
onTimeout: onTimeout,
),
);
},
cancelToken: cancelToken,
timeRetry: timeRetry,
retries: retries,
);
}