addThumbnailUrlForCat method
Future<NetworkResponse>
addThumbnailUrlForCat(
- dynamic bytes,
- dynamic filePath,
- dynamic label,
- dynamic catId,
override
Implementation
@override
Future<NetworkResponse> addThumbnailUrlForCat(
bytes, filePath, label, catId) 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,
"catId": catId,
});
Response response = await AppClients(
requiredToken: true, token: await appPrefs.getNormalToken())
.post(AppEndpoint.addThumbnailUrlForCat(), data: formData);
return NetworkResponse.fromResponse(response,
converter: (json) => ThumbnailUrlOfCat.fromJson(json));
} on DioError catch (e) {
return NetworkResponse.withErrorRequest(e);
}
}