ProfileDetails.fromJson constructor

ProfileDetails.fromJson(
  1. Map<String, dynamic> json
)

Factory method to create a ProfileDetails object from a map.

Implementation

factory ProfileDetails.fromJson(Map<String, dynamic> json) => ProfileDetails(
      contactType: json["contactType"] == "unknown"
          ? "unknown_contact"
          : json["contactType"] == "live"
              ? "live_contact"
              : json["contactType"] == "local"
                  ? "local_contact"
                  : json["contactType"] == "deleted"
                      ? "deleted_contact"
                      : json["contactType"],
      email: json["email"],
      groupCreatedTime: json["groupCreatedTime"].toString(),
      image: json["image"],
      imagePrivacyFlag: json["imagePrivacyFlag"].toString(),
      isAdminBlocked:
          Platform.isIOS ? json["isBlockedByAdmin"] : json["isAdminBlocked"],
      isBlocked: json["isBlocked"],
      isBlockedMe: json["isBlockedMe"],
      isGroupAdmin: json["isGroupAdmin"],
      isGroupInOfflineMode: json["isGroupInOfflineMode"],
      isGroupProfile: Platform.isIOS
          ? json["profileChatType"].toString().toLowerCase() == "singlechat"
              ? false
              : true
          : json["isGroupProfile"],
      isItSavedContact: json["isItSavedContact"],
      isMuted: json["isMuted"],
      isSelected: json["isSelected"],
      jid: json["jid"],
      lastSeenPrivacyFlag: json["lastSeenPrivacyFlag"].toString(),
      mobileNUmberPrivacyFlag: json["mobileNUmberPrivacyFlag"].toString(),
      mobileNumber: json["mobileNumber"],
      name: json["name"],
      nickName: json["nickName"],
      status: json["status"],
      thumbImage: json["thumbImage"],
    );