The StateMixin Class
Learn to manage a controller’s loading state with StateMixin.
Introduction to StateMixin
StateMixin, as the name suggests, lets us define the controller’s state. It’s a niche feature where we can declare any data type as the controller’s state and manage its status. The status can be a success
, error
, loading
, loadingMore
, or empty
. This feature becomes instrumental when dealing with REST API calls in the controller.
Implementation
Create UserModel
to serve as the state of the controller as follows:
Get hands-on with 1400+ tech skills courses.