What is a ViewModel
Class that stores UI data that survives configuration changes.
The sealed keyword in kotlin prevents inheritance true or false
false
What is risk analysis?
Thinking ahead about potential problems.
What is a Flow?
A stream that emits multiple values over time instead of returning once.
What is viewModel()?
Kotlin built-in function used to create an instance of ViewModel inside a composable
What are sealed classes?
Classes that are used to represent a fixed set of possible states.
If the consequences of my risk are rated 3 and the likelihood is 2, what is my risk ranking
6
What does collect() do?
It starts the flow similar to turning on a tap so values begin to flow.
What is the ViewModel’s role
layer of the app that acts as a bridge between the UI and data or business logic, providing state and logic to composables.
What are sealed classes comparable to in c#
Enums
How do we obtain a risk ranking, in other words what is the formula
We multiply likelihood and consequences
Difference between hot flow and cold flow
A hot flow keeps running and shares data with all collectors, while a cold flow starts only when collected and restarts for each.
What are coroutines?
Kotlin feature that lets you perform asynchronous tasks without freezing the UI by suspending and resuming execution.
How do sealed classes help with navigation routes?
They define all possible routes as subclasses, enabling type-safe, compile-time checked navigation.
What is a hot flow?
A hot flow is a stream of data that emits values regardless of whether there are any collectors listening
What is viewModelScope
A CoroutineScope provided by android for view models. Any coroutine launched in this scope is automatically cancelled when the ViewModel is cleared
What's the advantage of using sealed classes over enums for routes?
Sealed classes can hold data and different properties per route, while enums only represent constant values.
Difference between StateFlow and SharedFlow
StateFlow holds the latest state, while SharedFlow broadcasts events to many collectors.