spaceChildren property

List<SpaceChild> spaceChildren

List all children of this space. Children without a via domain will be ignored. Children are sorted by the order while those without this field will be sorted at the end of the list.

Implementation

List<SpaceChild> get spaceChildren => !isSpace
    ? throw Exception('Room is not a space!')
    : (states[EventTypes.spaceChild]
            ?.values
            .map((state) => SpaceChild.fromState(state))
            .where((child) => child.via?.isNotEmpty ?? false)
            .toList() ??
        [])
  ..sort((a, b) => a.order.isEmpty || b.order.isEmpty
      ? b.order.compareTo(a.order)
      : a.order.compareTo(b.order));