스마트시대
DIRECT MESSAGES 28.1 Send Message 28.2 StreamProvider 28.3 autoDispose 본문
Programing/Flutter
DIRECT MESSAGES 28.1 Send Message 28.2 StreamProvider 28.3 autoDispose
스마트시대 2023. 6. 6. 22:04728x90
28.1 Send Message








28.2 StreamProvider

이route에 있는 변경 사항을 listen하고 있는 것
.collection("chat_rooms")
.doc("pBBIEx03rE6EfisDgtbv")
.collection("texts")
.orderBy("createdAy")
여기서 어떤게 변경되었는지 이벤트(어떤 데이터가 들어있는 QueryShnapshot)로써 받을 수 있음(챗이 삭제되거나 추가, 수정)
.map(
(event) => event.docs
알림을 준 snapshot에 포함된 모든 documents(아래의 문서)를 한 번더 맵핑



28.3 autoDispose



autodispose를 해줘야하는 이유
riverpod는 플러터에 상관없이 그냥 클래스와 global variables
그래서 화면을 나가든 안 나가든 streamProvider는 계속 살아 있음


이거는 깃헙 코드 확인

728x90
반응형
'Programing > Flutter' 카테고리의 다른 글
Comments