changePhoto method

void changePhoto()

Implementation

void changePhoto() async {
  try {
    if (!WebFileSelector.isIOSWeb) {
      loadingDialog();
      final tmp = await ImagePicker().pickImage(source: ImageSource.gallery);
      if (tmp != null) {
        _uploadProfile(await tmp.readAsBytes());
      } else {
        closeDialog();
      }
    }
  } catch (e) {
    closeDialog();
    log('Error picking photo : ${e.toString()}');

    CustomFlashWidget.showFlashMessage(
      type: FlashType.error,
      title: "Error",
      message: "Failed to change photo. Please try again.",
    );
  }
}