GetView is unable to find the controller i registered using Bindings in Navigator. i navigate to the GetView with Get.toNamed() and pass the route name and the Navigator ID;
Hey, i have the following setup (for illustration):
The controller:
class DetailsPageController extends GetxController {...}
The binding:
class DetailsPageBindings extends Bindings {
@override
void dependencies() {
Get.put(DetailsPageController());
}
}
The method Navigator.onGenerateRoute returns the following GetPage for route /detailsPage:
GetPage(
name: "/detailsPage",
page: () => const DetailsPage(),
binding: DetailsPageBindings(),
)
The page itselft:
class DetailsPage extends GetView<DetailsPageController>() {...}
when i try to navigate to the page with Get.toNamed("/detailsPage", id:..., ), i get the following:
DetailsPageController() not found, you need to call Get.put() or Get.lazyPut()...
just replace your Get.put(); to Get.lazyPut(); in Bindings.
Example :