removePhoto method

void removePhoto()

Implementation

void removePhoto() async {
  try {
    final response = await Requests.getDio().put(
      '/users/update-user',
      data: {
        'imgUrl': null,
      },
    );

    if (response.statusCode == 200) {
      await authenticationController.getUserProfile();
      CustomFlashWidget.showFlashMessage(
        type: FlashType.success,
        title: "Success",
        message: "Removed profile photo successfully",
      );
    } else {
      log('Error removing profile photo: ${response.data}');
      CustomFlashWidget.showFlashMessage(
        type: FlashType.error,
        title: "Error",
        message: "Error occurred",
      );
    }
  } catch (_) {
    log('Error removing profile photo: ${_.toString()}');

    CustomFlashWidget.showFlashMessage(
      type: FlashType.error,
      title: "Error",
      message: "Error occurred",
    );
  }
}