Bindings
Learn about bindings, the classes where we initialize dependencies and bind them to the routes.
What are bindings?
Bindings are classes where we declare and initialize all our dependencies and bind them to the routes. This unique feature lets us separate dependency initialization from the presentation layer (widgets), making the code more organized.
Creating a bindings class
The class we create should implement the Bindings
class and override its dependencies
method. Inside the method, we can initialize all our dependencies using any dependency injection method, such as Get.put
, Get.lazyPut
, or Get.putAsync
.
Let’s see what the class looks like:
Get hands-on with 1400+ tech skills courses.