Смена аватара и логина во флаттере - PullRequest
0 голосов
/ 21 июня 2020

enter image description hereI am building a forum-like mobile application with flutter. When uploading a post, i saved the user details such as username, profile picture and details of the post into firebase as fields for that post's document. (Username and profile picture of the person who posted will be shown on the post) However, when i change my profile picture or username afterwards in settings, those appearing on the post were not updated accordingly. How do i rectify this such that relevant changes to user information will apply to the posts?

This is a snippet of how i had saved the data. I understand why the corresponding data will not update but i am not sure how to go about restructuring the code. База данных Firebase

1 Ответ

1 голос
/ 21 июня 2020

вы можете использовать StreamController для этой цели. определить StreamController в области приложения. вы можете подписаться на поток в виджете, где вы показываете изображение профиля, и вы можете писать в поток, когда обновляете изображение профиля из другого виджета, после того, как вы напишете в поток, подписанный виджет получит информацию, и вы можете обновите изображение, используя эту информацию.

...