getAllChatRooms method Null safety

  1. @Deprecated("")
Future<List<EMChatRoom>> getAllChatRooms()

Gets the list of chat rooms in the cache.

Return The list of chat rooms maintained by EMChatRoomManager.

Implementation

@Deprecated("")
Future<List<EMChatRoom>> getAllChatRooms() async {
  Map result = await _channel.invokeMethod(ChatMethodKeys.getAllChatRooms);
  try {
    EMError.hasErrorFromResult(result);
    List<EMChatRoom> list = [];
    result[ChatMethodKeys.getAllChatRooms]
        ?.forEach((element) => list.add(EMChatRoom.fromJson(element)));
    return list;
  } on EMError catch (e) {
    throw e;
  }
}