remember Draw Box Controller
fun rememberDrawBoxController(useCase: UseCase = UseCase(), initialState: State = State()): DrawBoxController
Composable factory function for creating and caching a DrawBoxController.
Uses Compose's viewModel API to ensure the same controller instance is retained across recompositions. Use this in your composable functions:
@Composable
fun MyScreen() {
val viewModel = rememberDrawBoxController()
val state by viewModel.state.collectAsState()
// ... use viewModel and state
}Content copied to clipboard
Return
Remembered DrawBoxController instance
Parameters
use Case
Optional custom use case instance. If not provided, a default is created. Override for custom business logic or persistence.
initial State
State used when the controller is first created.