getChatRoomWithId method Null safety
- String roomId
Gets the chat room in the cache.
Param roomId The chat room ID.
Return The chat room instance. Returns null if the chat room is not found in the cache.
Throws A description of the exception. See {@link ChatError}.
Implementation
Future<ChatRoom?> getChatRoomWithId(String roomId) async {
Map result = await _channel
.invokeMethod(ChatMethodKeys.getChatRoom, {"roomId": roomId});
try {
ChatError.hasErrorFromResult(result);
if (result.containsKey(ChatMethodKeys.getChatRoom)) {
return ChatRoom.fromJson(result[ChatMethodKeys.getChatRoom]);
} else {
return null;
}
} on ChatError catch (e) {
throw e;
}
}