title: How to return the data from the function but the value that I'm getting is not changed in flutter, how can I change the variable?
body: <p>What I'm trying to do is to return the assigned variable and use it as a Text in my Flutter app. I declared the variable as &quot;Results&quot; and after all the changes in the setState() the variable isn't what I want, however when I try to print the variable in the setState() I get the changed variable. How can I change this?</p>
  <p>Here is my code and function:</p>
  <pre><code>var _displayText = 'Results';
      final _database = FirebaseDatabase.instance.ref();
      _activateListeners() {
      _database.child('Friday').onValue.listen((event) {
          final description = event.snapshot.value;
          // print(description);
          setState(() {
            final _displayText = '$description';
            Text(_displayText);
          });
        });
        return _displayText;
      }
  _activateListeners();
  </code></pre>