enrichRooms function

Map<String, Room>? enrichRooms(
  1. Map<String, Room>? roomsData, {
  2. bool invite = false,
})

Processes the initial room data after the sync API is called the first time

Used for processing totally new events from the server

Adds things like the group name and invite status

Implementation

Map<String, Room>? enrichRooms(
  Map<String, Room>? roomsData, {
  bool invite = false,
}) {
  if (roomsData?.isNotEmpty ?? false) {
    final Map<String, Room> parsedRooms = <String, Room>{
      for (final String id in roomsData!.keys)
        if (roomsData[id] != null)
          id: enrichRoom(room: roomsData[id]!, roomID: id, invite: invite),
    };

    return parsedRooms;
  }
  return null;
}