onInit method

  1. @override
void onInit()
override

Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.

Implementation

@override
void onInit() {
  super.onInit();

  final findCurrentAccountController = Get.find<AccountUserController>();
  currentUser =
      findCurrentAccountController.currentUserAccounts.value.user.value;

  firstName.value.text = currentUser!.firstName!.value;

  lastName.value.text = currentUser!.lastName!.value;

  email.value.text = currentUser!.detailInfo!.value!.email.value ?? "";

  birthday.value.text =
      currentUser!.detailInfo!.value!.birthdayDate.value ?? "";

  if (currentUser!.detailInfo != null) {
    aboutme.value.text = currentUser!.detailInfo!.value!.about.toString();
  }

  if (currentUser!.detailInfo != null) {
    if (currentUser!.detailInfo!.value!.country.value != null) {
      country.value = currentUser!.detailInfo!.value!.country.value!.name;
      countryIndex = currentUser!.detailInfo!.value!.country.value!.countryID;
    }
  }

  if (currentUser!.detailInfo != null) {
    if (currentUser!.detailInfo!.value!.province.value != null) {
      province.value = currentUser!.detailInfo!.value!.province.value!.name;
      provinceIndex =
          currentUser!.detailInfo!.value!.province.value!.provinceID;
    }
  }

  if (ARMOYU.countryList.isNotEmpty) {
    if (ARMOYU.countryList[countryIndex!].provinceList != null) {
      provinceSelectStatus.value = true;
      // setstatefunction();
    }
  }
  if (ARMOYU.countryList.isEmpty) {
    fetchCountry();
  }
  if (currentUser!.detailInfo != null) {
    phoneNumber.value.text = formatString(
      currentUser!.detailInfo!.value!.phoneNumber.toString(),
    );
  }
}