NetworkManager<E extends INetworkModel<E> > class
Network manager provide your requests with Dio
Example:
NetworkManager(isEnableLogger: true, errorModel: UserErrorModel(),
options: BaseOptions(baseUrl: "https://jsonplaceholder.typicode.com/"));
- Inheritance
- Implemented types
Constructors
- NetworkManager({required BaseOptions options, E? errorModel, RefreshTokenCallBack? onRefreshToken, bool? skippingSSLCertificate, NoNetwork? noNetwork, bool? isEnableLogger, bool? isEnableTest, VoidCallback? onRefreshFail, IFileManager? fileManager, Interceptor? interceptor, OnReply? onReply})
- Network manager base request options
Properties
-
allHeaders
→ Map<
String, dynamic> -
Get all headers value
no setterinherited
-
cache
→ NetworkManagerCache<
INetworkModel> -
cache is a getter method that returns the
NetworkManagerCache
no setteroverride - dioInterceptors → Interceptors
-
The
Interceptors get dioInterceptors;
is a getter method that returns the interceptors used by the Dio HTTP client. Interceptors are functions that can be registered to intercept and modify HTTP requests or responses before they are sent or received.no setteroverride - errorModel → E?
-
E: Error Model for generic error
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- httpClientAdapter ↔ HttpClientAdapter
-
The adapter that the instance is using.
getter/setter pairinherited
-
instance
→ INetworkManager<
E> -
E: Error Model for generic error
no setter
- interceptors → Interceptors
-
Network manager interceptors
no setterinherited
- options ↔ BaseOptions
-
The base request config for the instance.
getter/setter pairinherited
- parameters ↔ NetworkManagerParameters
-
parameters is a getter method that returns
the
NetworkManagerParameters
for detaillatefinaloverride-getter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transformer ↔ Transformer
-
The default Transformer that transfers requests and responses
into corresponding content to send.
getter/setter pairinherited
Methods
-
addBaseHeader(
MapEntry< String, String> mapEntry) → void -
This method will add your MapEntry to header
inherited
-
addNetworkInterceptors(
Interceptor? interceptor) → void -
Add your custom network interceptor
inherited
-
clearHeader(
) → void -
Clear all headers value
inherited
-
close(
{bool force = false}) → void -
Shuts down the dio client.
inherited
-
delete<
T> (String path, {Object? data, Map< String, dynamic> ? queryParameters, Options? options, CancelToken? cancelToken}) → Future<Response< T> > -
Convenience method to make an HTTP DELETE request.
inherited
-
deleteUri<
T> (Uri uri, {Object? data, Options? options, CancelToken? cancelToken}) → Future< Response< T> > -
Convenience method to make an HTTP DELETE request with Uri.
inherited
-
download(
String urlPath, dynamic savePath, {ProgressCallback? onReceiveProgress, Map< String, dynamic> ? queryParameters, CancelToken? cancelToken, bool deleteOnError = true, String lengthHeader = Headers.contentLengthHeader, Object? data, Options? options}) → Future<Response> -
Download the file and save it in local. The default http method is "GET",
you can custom it by Options.method.
override
-
downloadFile(
String path, ProgressCallback? callback, {RequestType? method, Options? options, dynamic data}) → Future< Response< List< >int> ?> -
The
downloadFile
method is used to download a file from a specifiedpath
using an HTTP request. It returns aFuture<Response<List<int>?>>
which represents the response received from the server. The response contains the downloaded file as a list of integers.override -
downloadFileSimple(
String path, ProgressCallback? callback) → Future< Response< List< >int> > -
The
downloadFileSimple
method is used to download a file from a specifiedpath
using a simple HTTP GET request. It returns aFuture<Response<List<int>?>>
which represents the response received from the server. The response contains the downloaded file as a list of integers.override -
downloadUri(
Uri uri, dynamic savePath, {ProgressCallback? onReceiveProgress, CancelToken? cancelToken, bool deleteOnError = true, String lengthHeader = Headers.contentLengthHeader, Object? data, Options? options}) → Future< Response> -
Download the file and save it in local. The default http method is "GET",
you can custom it by Options.method.
inherited
-
errorResponseFetch<
R> (DioException exception) → ResponseModel< R, E> -
Error response fetch to parse it
inherited
-
fetch<
T> (RequestOptions requestOptions) → Future< Response< T> > -
The eventual method to submit requests. All callers for requests should
eventually go through this method.
inherited
-
fetchDataFromCache<
R, T extends INetworkModel< (T> >{required Duration? expiration, required RequestType type, required T responseModel}) → Future< ResponseModel< R?, E> ?> -
Fetch data from database
inherited
-
get<
T> (String path, {Map< String, dynamic> ? queryParameters, Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onReceiveProgress}) → Future<Response< T> > -
Convenience method to make an HTTP GET request.
inherited
-
getUri<
T> (Uri uri, {Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onReceiveProgress}) → Future< Response< T> > -
Convenience method to make an HTTP GET request with Uri.
inherited
-
handleNetworkError<
T extends INetworkModel< (T> , R>{required String path, required T parseModel, required RequestType method, required DioException error, required IResponseModel< R?, E?> onError(DioException e), String? urlSuffix = '', Map<String, dynamic> ? queryParameters, Options? options, Duration? expiration, dynamic data, ProgressCallback? onReceiveProgress, bool isErrorDialog = false, CancelToken? cancelToken, bool? forceUpdateDecode}) → Future<IResponseModel< R?, E?> > -
Manage any error according from server
inherited
-
head<
T> (String path, {Object? data, Map< String, dynamic> ? queryParameters, Options? options, CancelToken? cancelToken}) → Future<Response< T> > -
Convenience method to make an HTTP HEAD request.
inherited
-
headUri<
T> (Uri uri, {Object? data, Options? options, CancelToken? cancelToken}) → Future< Response< T> > -
Convenience method to make an HTTP HEAD request with Uri.
inherited
-
makeRequestBodyData(
dynamic data) → dynamic -
Make a body for request
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseUserResponseData<
R, T extends INetworkModel< (T> >dynamic responseBody, T model) → R? -
Parse response body
R: Response Model for user want to parse
T: Parser Model
inherited
-
patch<
T> (String path, {Object? data, Map< String, dynamic> ? queryParameters, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) → Future<Response< T> > -
Convenience method to make an HTTP PATCH request.
inherited
-
patchUri<
T> (Uri uri, {Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) → Future< Response< T> > -
Convenience method to make an HTTP PATCH request with Uri.
inherited
-
post<
T> (String path, {Object? data, Map< String, dynamic> ? queryParameters, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) → Future<Response< T> > -
Convenience method to make an HTTP POST request.
inherited
-
postUri<
T> (Uri uri, {Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) → Future< Response< T> > -
Convenience method to make an HTTP POST request with Uri.
inherited
-
put<
T> (String path, {Object? data, Map< String, dynamic> ? queryParameters, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) → Future<Response< T> > -
Convenience method to make an HTTP PUT request.
inherited
-
putUri<
T> (Uri uri, {Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) → Future< Response< T> > -
Convenience method to make an HTTP PUT request with Uri.
inherited
-
removeAll(
) → Future< bool> -
Remove all data from database
inherited
-
removeHeader(
String key) → void -
Remove header value with
key
inherited -
request<
T> (String path, {Object? data, Map< String, dynamic> ? queryParameters, CancelToken? cancelToken, Options? options, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) → Future<Response< T> > -
Make HTTP request with options.
inherited
-
requestUri<
T> (Uri uri, {Object? data, CancelToken? cancelToken, Options? options, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) → Future< Response< T> > -
Make http request with options with Uri.
inherited
-
send<
T extends INetworkModel< (T> , R>String path, {required T parseModel, required RequestType method, String? urlSuffix = '', Map< String, dynamic> ? queryParameters, Options? options, Duration? expiration, dynamic data, ProgressCallback? onReceiveProgress, bool isErrorDialog = false, CancelToken? cancelToken}) → Future<IResponseModel< R?, E?> > -
The
send
method is used to send an HTTP request to a specifiedpath
with various parameters. Here is a breakdown of the parameters:override -
sendPrimitive<
T> (String path, {Map< String, dynamic> ? headers}) → Future<T?> -
The
sendPrimitive
method is a generic method that is used to send a primitive HTTP request to a specifiedpath
. It takes thepath
as a parameter and an optionalheaders
parameter, which is a map of additional headers to be included in the request.override -
successResponseFetch<
T extends INetworkModel< (T> , R>{required dynamic data, required T parserModel}) → ResponseModel< R, E> -
Success response fetch to parse it
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
uploadFile<
T> (String path, FormData data, {Map< String, dynamic> ? headers}) → Future<Response< T> > -
The
uploadFile
method is used to upload a file to a specifiedpath
using an HTTP request. It takes thepath
of the file to be uploaded and aFormData
object containing the file data as parameters. Additionally, it can also accept an optionalheaders
parameter to include any custom headers in the request.override -
writeAll(
Duration? expiration, dynamic body, RequestType type) → Future< void> -
Write data to database
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited