I have issue with the below code written in Flutter. I am trying to implement a search bar where I will show the results based on the match query string. The variable isStorage is set to false in the beginning. However, when I try to update its value inside _getALlPosts(), it is not getting updated.
class _HomeState extends State<Home> {
final SearchBarController<Post> _searchBarController = SearchBarController();
bool isReplay = false;
bool isStorage = false;
Future<List<Post>> _getALlPosts(String text) async {
await Future.delayed(Duration(seconds: text.length == 4 ? 2 : 1));
List<Post> posts = [];
var random = new Random();
if (text.contains("pha")) {
isStorage = true;
}
}
}