When I change the state upon which a specific futurebuilder widget relies, the widget is not redrawn until the async task completes. I want the widget to be redrawn immediately once the state changes. Below is the code for the futurebuilder:
child: new FutureBuilder(
future: _api.getListOfTourneys(searchTerm, filterChecks, pageNum),
builder: (context, snapshot) {
if (snapshot.hasData) {
if(!(snapshot.data is List)){
return new TourneyItem(snapshot.data['tournament']);
}
return new Expanded(
child: ListView.builder(
shrinkWrap: false,
scrollDirection: Axis.vertical,
itemCount: snapshot.data.length,
itemBuilder: (BuildContext context, int index) {
return TourneyItem(snapshot.data[index]);
},
));
} else if (snapshot.hasError) {
return new Text("No results found");
} else {
return new CircularProgressIndicator();
}
},
)