fromJson static method

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

Implementation

static RTCContactModel? fromJson(Map<String, dynamic> json) {
  try {
    return RTCContactModel(
      contactUserId: json["contactUserId"],
      displayName: json["displayName"] ?? "Unknown",
      nickName: json["nickName"] ?? "",
      imageUrl: json["imageUrl"],
      createdOn: json["createdOn"] ?? 0,
      updatedOn: json["updatedOn"] ?? 0,
      description: json["description"] ?? '',
      // emails: json["emails"] ?? [],
      // phones: json["phones"] ?? [],
      emails: (json["emails"] as List? ?? [])
          .map((e) => e.toString())
          .toList(),
      phones: (json["phones"] as List? ?? [])
          .map((e) => e.toString())
          .toList(),
    );
  } catch (_) {
    return null;
  }
}