toJson method

Map<String, Object?> toJson()
override

Implementation

Map<String, Object?> toJson() {
  final avatarUrl = this.avatarUrl;
  final canonicalAlias = this.canonicalAlias;
  final joinRule = this.joinRule;
  final name = this.name;
  final roomType = this.roomType;
  final topic = this.topic;
  return {
    if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
    if (canonicalAlias != null) 'canonical_alias': canonicalAlias,
    'guest_can_join': guestCanJoin,
    if (joinRule != null) 'join_rule': joinRule,
    if (name != null) 'name': name,
    'num_joined_members': numJoinedMembers,
    'room_id': roomId,
    if (roomType != null) 'room_type': roomType,
    if (topic != null) 'topic': topic,
    'world_readable': worldReadable,
    'children_state': childrenState.map((v) => v.toJson()).toList(),
  };
}