title: Refresh part of screen in flutter
body: <p>EDIT - Complete Code. I added SetState and it didnt refresh.</p>
  
  <pre><code>class ForumPost extends StatefulWidget {
    @override
   _ForumPostState createState() =&gt; new _ForumPostState();
   final User user;
   final String postID; 
   final Features features;
    ForumPost({Key key, @required this.user, @required this.postID, @required this.features}) : super(key: key);
  }
  
  class _ForumPostState extends State&lt;ForumPost&gt; {
  List&lt;TabItem&gt; navItems = &lt;TabItem&gt;[
  TabItem(icon: Icons.home, title: 'Home'),
  TabItem(icon: Icons.help_outline, title: 'Support'),
  TabItem(icon: Icons.people, title: 'Contacts'),
  TabItem(icon: Icons.chat_bubble, title: 'Forum')
    ];
   List data;
   Future&lt;String&gt; getPostsByCategory() async {
  var response = await http.post(
    Uri.encodeFull("http://url/api/ForumPostByPostID"),
    headers: {"Content-Type": "application/json", 
               'Accept': 'application/json',},
    body: json.encode({'PostID' : widget.postID }));  
   this.setState(() {
   data = json.decode(response.body);
  }
  );
  
     return "Success!";
     }
  
   @override void initState() {
  
       this.getPostsByCategory();
   }
  
    @override
     Widget build(BuildContext context) {
     Future forumUpVote(String userid, String postID) async {
  
      final response =
         await http.post('http://url/api/ForumUpvote',
         headers: {"Content-Type": "application/json", 
                   'Accept': 'application/json',},
        body: json.encode({'userid' : userid , 'postID' : widget.postID}));
  
     if (response.statusCode == 204) {
      // Call was successful
     // Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) =&gt; new ForumPost(user: widget.user, postID: widget.postID, features: widget.features)));
         setState(() {
         });
      }
     }
          return new Scaffold(
       appBar:  AppBar(
       backgroundColor: Colors.grey,
       centerTitle: true,
       actions: &lt;Widget&gt;[
  
                    new IconButton( icon: new Icon(
                    FontAwesomeIcons.plusCircle,),
                     tooltip: 'Ask Question', 
                     onPressed: (){ 
                        Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) =&gt; new ForumAskQuestion( user: widget.user, features: widget.features)));
  
                       }
                  ),
  
                  new IconButton( icon: new Icon(
                    FontAwesomeIcons.search,),
                     tooltip: 'Search Community', 
                     onPressed: (){ 
                       print('pressed');
  
                       }
                  )
       ]
  ),
    bottomNavigationBar: ConvexAppBar.builder(
      user: widget.user,
      features: widget.features,
      count: navItems.length,
      backgroundColor: Colors.grey[700],
      tabBuilder: (BuildContext context, int index, bool active) {
        var navigationItem = navItems[index];
        var _color = active ? Colors.white : Colors.white60;
        var _icon = active
            ? navigationItem.activeIcon ?? navigationItem.icon
            : navigationItem.icon;
        return Container(
          color: Colors.transparent,
          padding: EdgeInsets.only(bottom: 2),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.end,
            children: &lt;Widget&gt;[
              Icon(_icon, color: _color),
              Text(navigationItem.title, style: TextStyle(color: _color, fontSize: 12.0))
            ],
          ),
        );
      },
      actionBuilder: (BuildContext context, int index, bool active) {
        var _color = active ? Colors.white : Colors.white60;
  
        return Stack(
          alignment: Alignment.center,
          children: &lt;Widget&gt;[
            SizedBox(
              width: 60,
              height: 60,
              child: Container(
                decoration:
                    BoxDecoration(shape: BoxShape.circle, color: _color),
                child: Icon(
                  Icons.chat_bubble,
                  size: 40,
                  color: Colors.red[200], 
                ),
              ),
            )
          ],
        );
      },
    ),
    body: Container(    
         decoration: BoxDecoration(
          gradient: new LinearGradient(
              colors: [Colors.white, Colors.grey],
              begin: Alignment.bottomLeft,
              end: Alignment.topRight
          )
      ),
   child:  ListView.builder(
      itemCount: data == null ? 0 : data.length,
      itemBuilder: (BuildContext context, int index){
       return new Card(
        child: Column( 
          mainAxisSize: MainAxisSize.min,
        children: &lt;Widget&gt;[
          ListTile(
            leading: Icon(Icons.beenhere, color: Colors.red, size: 35.0,),
            title: new Text(data[index]["Title"],style: new TextStyle(fontSize: 20.0, color: Colors.grey) ),
            subtitle: new Text(data[index]["Content"],style: new TextStyle(fontSize: 15.0, color: Colors.grey)),
            trailing: new Text(data[index]["FirstName"],style: new TextStyle(fontSize: 15.0, color: Colors.grey)),
            isThreeLine: true,
          ),
                 ButtonTheme.bar( // make buttons use the appropriate styles for cards
        child: ButtonBar(
          children: &lt;Widget&gt;[
             FlatButton(
              padding: EdgeInsets.all(10.0),
              child: Column( // Replace with a Row for horizontal icon + text
                children: &lt;Widget&gt;[
                Icon(Icons.thumb_up, color: Colors.grey[600]),
                  Text(data[index]["UpVote"].toString(), style: new TextStyle(color: Colors.grey))
                ],
              ),
  
  
  
              onPressed: () {
  
                 forumUpVote(widget.user.userId, widget.postID);
  
               },
            ),
             FlatButton(
              padding: EdgeInsets.all(10.0),
              child: Column( // Replace with a Row for horizontal icon + text
                children: &lt;Widget&gt;[
                Icon(Icons.question_answer, color: Colors.blue),
                  Text("Answer", style: new TextStyle(color: Colors.grey))
                ],
              ),
  
  
              onPressed: () {
  
                Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) =&gt; new ForumAnswerQuestion( user: widget.user, postID: widget.postID, posttitle: data[index]["Title"], features: widget.features )));
  
               },
            ),
            FlatButton(
               child: Column( // Replace with a Row for horizontal icon + text
                children: &lt;Widget&gt;[
                Icon(Icons.info_outline, color: Colors.orangeAccent),
                  Text(data[index]["AnswerCount"].toString(), style: new TextStyle(color: Colors.grey))
                ],
              ),
  
  
              onPressed: () {
  
                  Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) =&gt; new ForumPostsDetail( user: widget.user, postID: widget.postID, posttitle: data[index]["Title"], content: data[index]["Content"], features: widget.features )));
  
               },
            ),
  
             FlatButton(
               child: Column( // Replace with a Row for horizontal icon + text
                children: &lt;Widget&gt;[
                Icon(Icons.flag, color: Colors.red),
                  Text("Flag", style: new TextStyle(color: Colors.red))
                ],
              ),
  
  
              onPressed: () {
  
                  Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) =&gt; new ForumPostsDetail( user: widget.user, postID: widget.postID, posttitle: data[index]["Title"], content: data[index]["Content"], features: widget.features )));
  
               },
            ),
  
          ],
        ),
      ),
          ]
          ),
       );
       },
    ) 
    )
  
    );
    }
  
  }
  </code></pre>
  
  <p>We have a forum written in flutter and an upvote post function that calls a web api via http. We need the icon with the count of upvotes to refresh but not the entire screen. How is this done in flutter? We used to achieve this via AJAX in web pages.</p>
  
  <p>Here is the code for the upvote icon</p>
  
  <pre><code> children: &lt;Widget&gt;[
                Icon(Icons.thumb_up, color: Colors.green),
                  Text(data[index]["UpVote"].toString(), style: new TextStyle(color: Colors.grey))
                ],
  </code></pre>
  
  <p>Code for HTTP Call</p>
  
  <pre><code>   Future forumUpVote(String userid, String postID) async {
     final response =
    await http.post('http://url/api/ForumUpvote',
    headers: {"Content-Type": "application/json", 
               'Accept': 'application/json',},
    body: json.encode({'userid' : userid , 'postID' : widget.postID}));
  
    if (response.statusCode == 204) {
  // Call was successful
   Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) =&gt; new ForumPost(user: widget.user, postID: widget.postID, features: widget.features)));
  }
  }
  </code></pre>
  
  <p>When the response is successful it sends them back to the same screen which is why the entire screen refreshes. So Im guessing that we need to setstate() or something along those lines. Im not sure how to fix this.</p>