how to update a variable in a function in every for loop?
CharacterPage? currentPage; … Future<dynamic> pageGetter(int i, CharacterPage? x) async { Dio dio = Dio(); var pageData = await dio.get(‘https://rickandmortyapi.com/api/character?page=$i’); => // here i am if (pageData.statusCode == HttpStatus.ok) { //updating the x = CharacterPage.fromJson(pageData.data); //page number } //with int i if (mounted) { setState(() {}); } } … List<Character> filterByName() { pageGetter(1, currentPage); for (var […]