ChatModel class

Chat Model

이 모델은 채팅방의 데이터 모델이 아니라, 로직을 담고 있는 로직 모델이다. This model is not a data model for the chat room but a logic model containing the logic.

ChatService 에 모든 것을 다 집어 넣으면, 각 채팅 방마다 관리가 어렵고 동시에 두개의 채팅방을 열 수 없다. If all the logic is squeezed inside the ChatService, it is not easy to manage chat room. And it is very difficult to open more than one chat room at the same time. So, ChatModel is created to manage the logic of each chat room. And it is possible to open more than one chat room at the same time.

Constructors

ChatModel({required ChatRoom room})

Properties

hashCode int
The hash code for this object.
no setterinherited
messageOrder int
각 채팅방 마다, 맨 마지막 채팅 메시지의 order 값을 가지고 있는 배열
getter/setter pair
messageseRef → DatabaseReference
no setter
room ChatRoom
Set the current room.
getter/setter pair
roomsRef → DatabaseReference
no setter
roomSubscription StreamSubscription<DatabaseEvent>?
현재 방 listen, unlisten
getter/setter pair
rtdb → FirebaseDatabase
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
service → dynamic
no setter

Methods

isLoadingNewMessage(String messageRoomId, FirebaseQueryBuilderSnapshot snapshot) bool
누군가 채팅을 해서, 새로운 메시지가 전달되어져 왔는지 판단하는 함수이다.
joinPath(String roomId, String uid) String
leave() → dynamic
채팅방 나가기 (Exit the chat room)
messageRef({required String roomId}) → DatabaseReference
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetMessageOrder({required int? order}) → dynamic
채팅방 메시지 순서
resetNewMessage({int? order, ChatRoom? join}) Future<void>
채팅방 정보 /chat-joins/$uid/$otherUid 에서 newMessage 를 0 으로 초기화 한다.
resetRoom({required ChatRoom room}) → dynamic
roomRef(String roomId) → DatabaseReference
roomUserRef(String roomId, String uid) → DatabaseReference
roomUserRef is the reference to the users node under the group chat room. Ex) /chat-rooms/{roomId}/users/{my-uid}
sendMessage({String? text, String? url, bool force = false}) Future<void>
채팅 메시지 전송
subscribeRoomUpdate({Function? onUpdate}) → dynamic
toString() String
A string representation of this object.
inherited
unsubscribeRoomUpdate() → dynamic
updateUrlPreview(DatabaseReference ref, String? text) Future
URL Preview 업데이트

Operators

operator ==(Object other) bool
The equality operator.
inherited