ProfileModel.fromJson constructor

ProfileModel.fromJson(
  1. Map json, {
  2. Map? data,
})

Implementation

ProfileModel.fromJson(Map<dynamic, dynamic> json,{Map<dynamic,dynamic>? data}) {
  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'];

  userWalletCode = json['user_wallet_code_new'];

  total_community_post = data?['total_community_post'];
  total_follower = data?['total_follower'];
  total_following = data?['total_following'];
  is_follow = data?['is_follow'];
  can_input_referral = data?['can_input_referral'];
  rotationImage = int.parse(json['image_rotation'].toString());


  bandfnama = json['band_fnama'];
  bandbio = json['band_bio'];
  bandimage = json['band_image'];
  isFollow = json['is_follow'];
  isBlocked = json['is_blocked'];

  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'];
  isAdminVerif = json['is_admin'].toString();

  // if (json['is_admin'] == '1') {
  //   isAdminVerif = json['is_admin'].toString();
  // } else {
  //   isAdminVerif = null;
  // }
  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'];
}