updateThumbnailUrlForCat method
Future<NetworkResponse>
updateThumbnailUrlForCat(
- dynamic bytes,
- dynamic filePath,
- dynamic label,
- dynamic id,
override
Implementation
@override
Future<NetworkResponse> updateThumbnailUrlForCat(
bytes, filePath, label, id) async {
bool isDisconnect = await WifiService.isDisconnect();
if (isDisconnect) return NetworkResponse.withDisconnect();
try {
String fileName = filePath.split('/').last;
FormData formData = FormData.fromMap({
"fileName": MultipartFile.fromBytes(bytes, filename: fileName),
"label": label,
"id": id,
});
Response response = await AppClients(
requiredToken: true, token: await appPrefs.getNormalToken())
.put(AppEndpoint.updateThumbnailUrlForCat(), data: formData);
return NetworkResponse.fromResponse(response,
converter: (json) => ThumbnailUrlOfCat.fromJson(json));
} on DioError catch (e) {
return NetworkResponse.withErrorRequest(e);
}
}