onSelectedPhoto method

void onSelectedPhoto(
  1. List<XFile> files
)

Implementation

void onSelectedPhoto(List<XFile> files) async {
  try {
    if (files.firstOrNull != null) {
      loadingDialog();
      _uploadProfile(await files.firstOrNull!.readAsBytes());
    }
  } catch (e) {
    closeDialog();
    log('Error picking photo : ${e.toString()}');

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