newbie here. How do I re-run onInit() every time I push back to my screen? onInit() runs only once but navigating back to a previous screen does not delete the controller which was initialized (FetchData) hmmm..
I'm only using Get.back() every time I want to pop page, and Get.toNamed() every time I want to navigate on a named route
the only thing I want to happen is to delete the Initialized controller (FetchData) every time I pop the page but I have no Idea how to do it.
my GetxController
class FetchData extends GetxController {
RxList items = [].obs;
@override
onInit() {
fetchData();
super.onInit();
}
Future<void> fetchData() async {
var result = await http.get("api.url");
items.value = result.body;
}
}
Thanks in advance!