The Get.create Method
Learn to use Get.create to serve a specific use case.
Background
Traditionally, dependency injection is used to share the same class instance across multiple widgets. However, in some cases, we may wish to create new instances to maintain separate states of the same class. This is when Get.create
comes into the picture. When we initialize a dependency using Get.create
, a new instance of the dependency is created every time Get.find
is called.
This feature becomes instrumental when we have a page with multiple widgets that use the same controller but do not share the same state of the controller. For example, a shopping cart page:
Get hands-on with 1400+ tech skills courses.