initialBinding: BindingsBuilder(
Get.put(LoginController());
Get.put(MainController());
Get.put(AuthController());
Get.put(SignupController());
Get.put(PostController());
),
AppPages(
name : LoginPage.route,
page: () => const LoginPage(),
binding: BindingBuilder((){
Get.put(LoginController());
})
)
var controller = Get.find<LoginController>();
또는
class LoginPage extends GetView<LoginController> {
const LoginPage({super.key});
static const String route = '/login'
Widget build(BuildContext context) {
return Scaffold();
}
}
class AppPages{
static final pages = [
GetPage(name: LoginPage.route,
page: () => LoginPage()
binding: BindingBuilder((){
Get.put(LoginController());
}
),
GetPage(name: LoginPage.route,
page: () => LoginPage()
binding: BindingBuilder((){
Get.put(LoginController());
}
),
GetPage(name: LoginPage.route,
page: () => LoginPage()
binding: BindingBuilder((){
Get.put(LoginController());
}
),
]
}
GetMaterialApp(
...
getPages: AppPages.pages
)
initialBinding: BindingsBuilder(
Get.put(LoginController());
Get.put(MainController());
Get.put(AuthController());
Get.put(SignupController());
Get.put(PostController());
),
아 이따가 쓰기전에 컨트롤러 메모리에 올려줄게..ㄹ ㅇ 루
initialBinding: BindingsBuilder(
Get.lazyPut(() => LoginController());
),