For context, suppose I have Flutter code which displays a CircularProgressIndicator while code is being fetched from an API:
Future<void> getItems() async {
setState(ViewState.Busy);
items = await _api.getItems();
setState(ViewState.Idle);
}
So that the CircularProgressIndicator does not display for only a fraction of a second (which I find disrupts the flow of related animations), I want to make this indicator display for a minimum amount of time.
I think I can solve this problem using the Future API or a timer, by somehow setting the minimum amount of time a HTTP request future can take. How can I go about achieving this?