ProfileModel.fromJson constructor

ProfileModel.fromJson(
  1. Map json
)

Implementation

ProfileModel.fromJson(Map<dynamic, dynamic> json) {
  nationCode = json['nation_code'];
  id = json['id'];
  fbId = json['fb_id'];
  appleId = json['apple_id'];
  googleId = json['google_id'];
  email = json['email'];
  fnama = json['fnama'];
  lnama = json['lnama'];
  latitude = json['latitude'];
  longitude = json['longitude'];
  kelamin = json['kelamin'];
  bdate = json['bdate'];
  cdate = json['cdate'];
  adate = json['adate'];
  edate = json['edate'];

  if (json['telp'] != null) {
    telp = json['telp'];
  } else {
    telp = '';
  }
  if (json['language_id'] != null) {
    language_id = json['language_id'];
  } else {
    // language_id = '';
  }
  image = json['image'];
  introTeks = json['intro_teks'];
  bio = json['bio'];
  website = json['website'];
  imageBanner = json['image_banner'];
  apiSocialId = json['api_social_id'];
  fcmToken = json['fcm_token'];
  device = json['device'];
  isAgree = json['is_agree'];
  isConfirmed = json['is_confirmed'];
  isActive = json['is_active'];
  telpIsVerif = json['telp_is_verif'];
  apiMobileEdate = json['api_mobile_edate'];
  spesialUser = json['can_post_protection_product'];
  if (json['is_admin'] == '1') {
    isAdminVerif = true;
  } else {
    isAdminVerif = false;
  }
  if (json['kode_referral'] != null) {
    kodeReferral = json['kode_referral'];
  }

  if (json['bKodeRecuiter'] != null) {
    bKodeRecuiter = json['bKodeRecuiter'];
  }
  if (json['bNamaRecuiter'] != null) {
    bNamaRecuiter = json['bNamaRecuiter'];
  }

  if (json['b_user_id_recruiter'] != null) {
    buserRecuiter = json['b_user_id_recruiter'].toString();
    // buserRecuiter = "1";
  }
  if (Config.AppVersion == VersionApps.indonesia) {
    if (json["country_origin"] == null) {
      country = "indonesia";
    } else {
      country = json['country_origin'];
    }

    if (json['is_changed_address'] == null) {
      isChangedAddress = "1";
    } else {
      isChangedAddress = json['is_changed_address'];
    }

    if (json['total_product'] != null) {
      if (json['total_product'] is int) {
        totalProduct = json['total_product'];
      } else {
        totalProduct = int.parse(json['total_product']);
      }
    } else {
      // totalProduct = 0;
    }
  } else {
    country = "";
  }
  isResetPassword = json['is_reset_password'];
  defaultAddress = (json['default_address'] != null
      ? new DefaultAddress.fromJson(json['default_address'])
      : null)!;
  apisess = json['apisess'];
  apisessExpired = json['apisess_expired'];
  canInputReferral = json['can_input_referral'];
}