HttpService constructor
HttpService({
- Client? client,
- bool? ownsClient,
- Config? config,
- AuthTokenProvider? tokenProvider,
- Duration timeout = defaultTimeout,
- Duration uploadTimeout = defaultUploadTimeout,
Every dependency is injectable so the transport can be exercised without
a server. client also lets an application supply its own - one with
certificate pinning, a proxy, or request logging.
Implementation
HttpService({
http.Client? client,
bool? ownsClient,
Config? config,
AuthTokenProvider? tokenProvider,
Duration timeout = defaultTimeout,
Duration uploadTimeout = defaultUploadTimeout,
}) : _client = client ?? http.Client(),
_ownsClient = ownsClient ?? (client == null),
config = config ?? Config(),
_tokenProvider = tokenProvider,
_timeout = timeout,
_uploadTimeout = uploadTimeout;