Di Scope
The DiScope class is at the heart of this Lifecycle Awareness approach. It works side by side with LifecycleOwner to give ability to define a scope, register its dependencies, and automatically dispose of it when it’s no longer needed.Attributes:
Name | Type | Description | Default Value | Required | Nullable |
---|---|---|---|---|---|
name |
| The identifier for the scope, which helps in managing and referencing the scope. | - | ||
factory |
| The function that initializes the scope’s dependencies. | - | ||
dispose |
| Controls whether the scope can be disposed independently of its LifecycleOwner. If dispose is set to true, the scope can be manually disposed outside the context of the screen lifecycle. |
| ||
disposeByOwner |
| Determines whether the scope is disposed when the lifecycle owner (e.g., the screen) is disposed. |
| ||
dependencies |
| Array of other scopes that need to be initialized before the current scope. |
|