title: Flutter Firebase RTDB onValue triggered multiple times
body: <p>I'm developing an app which needs live data from the database which was created using Firebase RTDB. I used onValue to get the live data, the problem is that the onValue is triggered multiple times when a lot of data changed at once and messed up my data processing system. Been trying to look for solutions, but still haven't managed to find one. Any help will be appreciated. Here's the code:</p>
  <pre><code>await refConnection
          .child(user!.uid).orderByChild('date_created').onValue.forEach((element) {
            if (element.snapshot.value != null) {
              Map&lt;dynamic, dynamic&gt; connection = element.snapshot.value as Map&lt;
                  dynamic,
                  dynamic&gt;;
              print(&quot;Test: $connection&quot;);
              
  
              connection.forEach((key, value) {
                if (connection[key]['status'] == 'connected') {
                  Provider.of&lt;ContactDataProvider&gt;(context, listen: false)
                      .addConnected(connection[key]);
                } else if (connection[key]['status'] == 'incoming_req') {
                  Provider.of&lt;ContactDataProvider&gt;(context, listen: false)
                      .addIncoming(connection[key]);
                } else if (connection[key]['status'] == 'sent_req') {
                  print(connection[key]);
                  Provider.of&lt;ContactDataProvider&gt;(context, listen: false)
                      .addSent(connection[key]);
                }
              });
  
              setState();
            }
      });
  </code></pre>