HttpServiceBase class abstract

Inheritance
  • Object
  • DisposableObject
  • HttpServiceBase

Constructors

HttpServiceBase(Dio dioInstance)

Properties

cancelTokens List<CancelToken>
getter/setter pair
dioInstance Dio
final
disposed bool
disposed will be true if this object was disposed
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearTokens() → void
Clear all pending requests
deleteData<T extends ResponseBase>({required RequestBase request, required T mapper(Map<String, dynamic>, Response response), T orElse(dynamic, Response response)?, Options? options, bool cancelOnDispose = true, Map<String, dynamic> queryParameters = const {}, int expectedStatusCode = 200, bool allowCache = true}) Future<T>
Perform a query using the "DELETE" method. The body of the request is extracted from request's toData method Optionally pass queryParameters for query parameters attached to the request Use mapper to map the json response Optionally you can use the orElse to map other kind of response Optionally you can specify options to pass to Dio cancelOnDispose lets you cancel the request if this service is disposed expectedStatusCode to check the result of the request set allowCache to true to skip che expectedStatusCode when response
deleteJson<T extends ResponseBase>({required RequestBase request, required T mapper(Map<String, dynamic>, Response response), T orElse(dynamic, Response response)?, Options? options, bool cancelOnDispose = true, Map<String, dynamic> queryParameters = const {}, int expectedStatusCode = 200, bool allowCache = true}) Future<T>
Perform a query using the "DELETE" method and using the JSON content type The body of the request is extracted from request Optionally pass queryParameters for query parameters attached to the request Use mapper to map the json response Optionally you can use the orElse to map other kind of response Optionally you can specify options to pass to Dio cancelOnDispose lets you cancel the request if this service is disposed expectedStatusCode to check the result of the request set allowCache to true to skip che expectedStatusCode when response
dispose() → void
call dispose to dispose the object and mark it as disposed
inherited
disposeInstance() → void
Override this method to provide dispose logic for the concrete object.
override
download({required RequestBase request, required String path, Options? options, bool cancelOnDispose = true, int expectedStatusCode = 200, bool allowCache = true, bool deleteOnError = true, void onReceiveProgress(int count, int total)?}) Future<void>
Downloads a file. The query parameters are extracted from request's toJson Eventual additional data is extracter from request's toData Optionally you can specify options to pass to Dio cancelOnDispose lets you cancel the request if this service is disposed expectedStatusCode to check the result of the request set allowCache to true to skip the expectedStatusCode check when the response is a cached one (HTTP code 304) onReceiveProgress allows to know about the status of the download deleteOnError deletes the file if an error occurs
getBytes({required RequestBase request, Options? options, bool cancelOnDispose = true, int expectedStatusCode = 200, bool allowCache = true}) Future<BytesResponse>
Get bytes from an api. The query parameters are extracted from request Optionally you can specify options to pass to Dio cancelOnDispose lets you cancel the request if this service is disposed expectedStatusCode to check the result of the request set allowCache to true to skip the expectedStatusCode check when the response is a cached one (HTTP code 304)
getNextToken() CancelToken
Get a token to attach to a request in order to dispose it later
getQuery<T extends ResponseBase>({required RequestBase request, required T mapper(Map<String, dynamic>, Response response), T orElse(dynamic, Response response)?, Options? options, bool cancelOnDispose = true, int expectedStatusCode = 200, bool allowCache = true}) Future<T>
Perform a query using the "GET" method. The query parameters are extracted from request Use mapper to map the json response Optionally you can use the orElse to map other kind of response Optionally you can specify options to pass to Dio cancelOnDispose lets you cancel the request if this service is disposed expectedStatusCode to check the result of the request set allowCache to true to skip the expectedStatusCode check when the response is a cached one (HTTP code 304)
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patchData<T extends ResponseBase>({required RequestBase request, required T mapper(Map<String, dynamic>, Response response), T orElse(dynamic, Response response)?, Options? options, bool cancelOnDispose = true, Map<String, dynamic> queryParameters = const {}, int expectedStatusCode = 200, bool allowCache = true}) Future<T>
Perform a query using the "PATCH" method. The body of the request is extracted from request's toData method Optionally pass queryParameters for query parameters attached to the request Use mapper to map the json response Optionally you can use the orElse to map other kind of response Optionally you can specify options to pass to Dio cancelOnDispose lets you cancel the request if this service is disposed expectedStatusCode to check the result of the request set allowCache to true to skip che expectedStatusCode when response
patchJson<T extends ResponseBase>({required RequestBase request, required T mapper(Map<String, dynamic>, Response response), T orElse(dynamic, Response response)?, Options? options, bool cancelOnDispose = true, Map<String, dynamic> queryParameters = const {}, int expectedStatusCode = 200, bool allowCache = true}) Future<T>
Perform a query using the "PATCH" method and using the JSON content type The body of the request is extracted from request Optionally pass queryParameters for query parameters attached to the request Use mapper to map the json response Optionally you can use the orElse to map other kind of response Optionally you can specify options to pass to Dio cancelOnDispose lets you cancel the request if this service is disposed expectedStatusCode to check the result of the request set allowCache to true to skip che expectedStatusCode when response
postData<T extends ResponseBase>({required RequestBase request, required T mapper(Map<String, dynamic>, Response response), T orElse(dynamic, Response response)?, Options? options, bool cancelOnDispose = true, Map<String, dynamic> queryParameters = const {}, int expectedStatusCode = 200, bool allowCache = true}) Future<T>
Perform a query using the "POST" method. The body of the request is extracted from request's toData method Optionally pass queryParameters for query parameters attached to the request Use mapper to map the json response Optionally you can use the orElse to map other kind of response Optionally you can specify options to pass to Dio cancelOnDispose lets you cancel the request if this service is disposed expectedStatusCode to check the result of the request set allowCache to true to skip che expectedStatusCode when response
postJson<T extends ResponseBase>({required RequestBase request, required T mapper(Map<String, dynamic>, Response response), T orElse(dynamic, Response response)?, Options? options, bool cancelOnDispose = true, Map<String, dynamic> queryParameters = const {}, int expectedStatusCode = 200, bool allowCache = true}) Future<T>
Perform a query using the "POST" method and using the JSON content type The body of the request is extracted from request Optionally pass queryParameters for query parameters attached to the request Use mapper to map the json response Optionally you can use the orElse to map other kind of response Optionally you can specify options to pass to Dio cancelOnDispose lets you cancel the request if this service is disposed expectedStatusCode to check the result of the request set allowCache to true to skip che expectedStatusCode when response
putData<T extends ResponseBase>({required RequestBase request, required T mapper(Map<String, dynamic>, Response response), T orElse(dynamic, Response response)?, Options? options, bool cancelOnDispose = true, Map<String, dynamic> queryParameters = const {}, int expectedStatusCode = 200, bool allowCache = true}) Future<T>
Perform a query using the "PUT" method. The body of the request is extracted from request's toData method Optionally pass queryParameters for query parameters attached to the request Use mapper to map the json response Optionally you can use the orElse to map other kind of response Optionally you can specify options to pass to Dio cancelOnDispose lets you cancel the request if this service is disposed expectedStatusCode to check the result of the request set allowCache to true to skip che expectedStatusCode when response
putJson<T extends ResponseBase>({required RequestBase request, required T mapper(Map<String, dynamic>, Response response), T orElse(dynamic, Response response)?, Options? options, bool cancelOnDispose = true, Map<String, dynamic> queryParameters = const {}, int expectedStatusCode = 200, bool allowCache = true}) Future<T>
Perform a query using the "PUT" method and using the JSON content type The body of the request is extracted from request Optionally pass queryParameters for query parameters attached to the request Use mapper to map the json response Optionally you can use the orElse to map other kind of response Optionally you can specify options to pass to Dio cancelOnDispose lets you cancel the request if this service is disposed expectedStatusCode to check the result of the request set allowCache to true to skip che expectedStatusCode when response
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited