setMainImage method
Set an image as the main image
Implementation
Future setMainImage({required ApiRequest apiRequest}) async {
FormData formData = FormData();
if (apiRequest.postData != null) {
formData.fields.add(
MapEntry(apiRequest.postDataKey, apiRequest.postData),
);
}
/// setup the API for the request
_setupApiFromRequest(apiRequest);
Uri uri = Uri.parse(apiRequest.url);
return await network(
request: (api) => api.request(
uri.path,
queryParameters: uri.queryParameters,
data: formData,
options: Options(method: apiRequest.method.toUpperCase()),
),
baseUrl: uri.origin,
headers: apiRequest.headers,
handleFailure: apiRequest.onError,
);
}