extended_http 1.0.2 extended_http: ^1.0.2 copied to clipboard
Extends HTTP package to provide cache, store user credential, predefined authorization workflow, set custom request headers, beautiful logs and easy debugging with request debugId
Changelog #
[1.0.2] - Mar 15, 2023 #
- Update package description
[1.0.1] - Mar 15, 2023 #
-
Support custom config on each path, example
createURI( '/api/posts', overrideConfig: HttpOptionalConfig( headers: { "Content-Type": "application/x-www-form-urlencoded", }, ), )
[1.0.0] - Mar 15, 2023 #
-
New
CachePolicy
with 3 options:NetworkFirst
Fetch data from network, if failed, fetch from cache.CacheFirst
Fetch data from cache, if not existed, fetch from network.NoCache
Only fetch data from network. Never store data in cache.
-
Support multiple instances for multiple API domains, example:
ExtendedHttp()
=> get/set for default instanceExtendedHttp("domain1")
=> get/set for instance of domain1ExtendedHttp("domain2")
=> get/set for instance of domain2
-
Add
debugId
to easy filter out relevant logs when debugging, exampleExtendedHttp().createURI( '/api', debugId: '123', )
-
Add
authData
for easy saving user credential, it can be used to store token or current user data.- Setter:
setAuthData(Map<String, dynamic> data)
- Getter:
authData
- Method of
onUnauthorized
now also haveauthData
as parameter.
- Setter:
-
Add getter
headers
to get current headers and settersetHeaders
[0.3.5] - Feb 15, 2023 #
- Fix log error when response body is null
[0.3.4] - Oct 25, 2022 #
Improve logging with color and added new log options
- logURL
- logRequestHeaders
- logRespondHeaders
- logRespondBody
[0.2.4] - Oct 25, 2022 #
Expose onError
method so you can define your own logic there
[0.1.4] - Oct 21, 2022 #
Expose shouldRetry
method so you can define your own logic there
[0.0.4] - Oct 21, 2022 #
Improve config headers to add new values instead of replace all.
From now, when calling config(headers: {new-headers})
- matched headers will be overwritten
- while others headers will be kept
[0.0.3] - Oct 5, 2022 #
Remove import dart:io
[0.0.2] - Oct 5, 2022 #
Update package description
[0.0.1] - Oct 5, 2022 #
Splitted from remote_data_provider
Support API response caching and custom authorization headers