updateProfileImage method
dynamic
updateProfileImage({
- required String path,
- bool update = false,
- required BuildContext context,
Implementation
updateProfileImage({required String path, bool update = false, required BuildContext context}) async {
if(await AppUtils.isNetConnected()) {
loading.value = true;
// if(checkFileUploadSize(path, Constants.mImage)) {
if(context.mounted)showLoader(context);
Mirrorfly.updateMyProfileImage(path).then((value) {
mirrorFlyLog("updateMyProfileImage", value);
loading.value = false;
var data = json.decode(value);
imagePath.value = Constants.emptyString;
userImgUrl.value = data['data']['image'];
SessionManagement.setUserImage(data['data']['image'].toString());
hideLoader(context);
if (update) {
save(context: context);
}
}).catchError((onError) {
debugPrint("Profile Update on error--> ${onError.toString()}");
loading.value = false;
hideLoader(context);
});
// }else{
// toToast("Image Size exceeds 10MB");
// }
}else{
toToast(AppConstants.noInternetConnection);
}
}