setSpaceChild method

Future<void> setSpaceChild(
  1. String roomId, {
  2. List<String>? via,
  3. String? order,
  4. bool? suggested,
})

Adds or edits a child of this space.

Implementation

Future<void> setSpaceChild(
  String roomId, {
  List<String>? via,
  String? order,
  bool? suggested,
}) async {
  if (!isSpace) throw Exception('Room is not a space!');
  via ??= [client.userID!.domain!];
  await client.setRoomStateWithKey(id, EventTypes.spaceChild, roomId, {
    'via': via,
    if (order != null) 'order': order,
    if (suggested != null) 'suggested': suggested,
  });
  await client.setRoomStateWithKey(roomId, EventTypes.spaceParent, id, {
    'via': via,
  });
  return;
}