title: Dispose data flutter
body: <p>I am fetching data from API every second, the goal is to make the information realtime as much as possible. I want to properly dispose of the old data whenever I fetch new data.</p>
  <pre><code>  Future&lt;List&lt;Orders&gt;&gt; getStudentList() async {
      final response = await http.get(Uri.parse(&quot;${Env.URL_PREFIX}/order_list.php&quot;));
      final items = json.decode(response.body).cast&lt;Map&lt;String, dynamic&gt;&gt;();
      List&lt;Orders&gt; students = items.map&lt;Orders&gt;((json) {
        return Orders.fromJson(json);
      }).toList();
      print(students);
      return students;
    }
  
  
  
    setUpTimedFetch() {
      Timer.periodic(Duration(milliseconds: 1000), (timer) {
        setState(() {
          orders = getStudentList();
        });
      });
    }
  </code></pre>
  <p>How do I efficiently do this?</p>