putData<T extends ResponseBase> method
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
Implementation
@protected
Future<T> putData<T extends ResponseBase>({
required RequestBase request,
required T Function(Map<String, dynamic>, Response response) mapper,
T Function(dynamic, Response response)? orElse,
Options? options,
bool cancelOnDispose = true,
Map<String, dynamic> queryParameters = const {},
int expectedStatusCode = 200,
bool allowCache = true,
}) async {
final performer = () => dioInstance.put(
request.endpoint,
data: request.toData(),
queryParameters: queryParameters,
options: options,
cancelToken: cancelOnDispose ? getNextToken() : null,
);
return _perform(performer, mapper, orElse, expectedStatusCode, allowCache);
}