Reputation: 2419
I have a situation that only is fixed by get.create in getx package I have the following code
class ShoppingBinding implements Bindings {
@override
void dependencies() {
Get.create<ShoppingController>(() => ShoppingController());
}
}
but I don't know how to call this thanks in advance
Upvotes: 0
Views: 1160
Reputation: 171
you should create routing in GetMaterialApp :
getPages: AppPages.pages,
initialRoute: AppPages.INITIAL_ROUTE,
and in AppPages class :
GetPage(
name: AppRoutes.ShoppingRouteName,
page: () => ShoppingWidget(),
binding: ShoppingBinding()),
Finally :
Get.toNamed(AppRoutes.ShoppingRouteName),
and in shopWidget :
class ShoppingWidget extends GetView<ShoppingController> {
Upvotes: 1