How to rebuild Widget after updating data to RTDB flutter

Viewed 16

Hi I'm new to flutter and I'm currently trying to work with Realtime Database from firebase. I manage to get all my data from RTDB and I also made function to edit the data in RTDB.

The problem is I cannot make my Widget to rebuild when I already done updating the RTDB data.

Here's how the process of the Data fetching and updating goes:

  1. First, We will have variable A on screen A to fetch the RTDB data in the initState
  2. Second, the fetched data will be used to create Widget of Text in Screen A
  3. Third, there will be a button on screen A to push the screen to Screen B (Editing Page)
  4. Fourth, After the user done editing it will push the user into Splash Screen and it will be Pop back to screen A
  5. Fifth (Here's the problem), the Widget still build the old data, not the new data that has been edited.

I thought after step 4, Screen A will do the fetching again in initState.. Am I wrong ? How can I do the rebuild of widget ? Thanks before

0 Answers
Related