groupDtoToSpaceDto function
Implementation
SpaceDTO groupDtoToSpaceDto(GroupDTO groupDto) {
Map<String, dynamic> groupData = groupDto.toJson();
return SpaceDTO(
members: (groupData['members'] as List<dynamic>)
.map((member) => SpaceMemberDTO(
wallet: member['wallet'],
publicKey: member['publicKey'],
isSpeaker: member['isAdmin'],
image: member['image'],
))
.toList(),
pendingMembers: (groupData['pendingMembers'] as List<dynamic>)
.map((pendingMember) => SpaceMemberDTO(
wallet: pendingMember['wallet'],
publicKey: pendingMember['publicKey'],
isSpeaker: pendingMember['isAdmin'],
image: pendingMember['image'],
))
.toList(),
contractAddressERC20: groupData['contractAddressERC20'],
numberOfERC20: groupData['numberOfERC20'],
contractAddressNFT: groupData['contractAddressNFT'],
numberOfNFTTokens: groupData['numberOfNFTTokens'],
verificationProof: groupData['verificationProof'],
spaceImage: groupData['groupImage'],
spaceName: groupData['groupName'],
isPublic: groupData['isPublic'],
spaceDescription: groupData['groupDescription'],
spaceCreator: groupData['groupCreator'],
spaceId: groupData['chatId'],
scheduleAt: groupData['scheduleAt'] != null
? DateTime.parse(groupData['scheduleAt'])
: null,
scheduleEnd: groupData['scheduleEnd'] != null
? DateTime.parse(groupData['scheduleEnd'])
: null,
status: groupData['status'] != null
? chatStatusFromString(groupData['status'])
: null,
meta: groupDto.meta,
);
}