TUIUserInfo.fromJson constructor

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

Implementation

TUIUserInfo.fromJson(Map<String, dynamic> json) {
  userId = json["user_id"];
  userName = json["user_name"];
  nameCard = json["name_card"];
  avatarUrl = json["avatar_url"];
  userRole = TUIRoleExt.fromValue(json["user_role"]);
  hasAudioStream = json["has_audio_stream"];
  hasVideoStream = json["has_video_stream"];
  hasScreenStream = json["has_screen_stream"];
  isMessageDisabled = json["is_message_disabled"];

  Map<String, dynamic> customJsonMap = jsonDecode(json["custom_info"]) ?? {};
  if (customJsonMap.isNotEmpty) {
    customInfo ??= {};
    customJsonMap.forEach((key, value) {
      customInfo![key] = value.toString();
    });
  }
}