The ProfileProvider is a service component responsible for managing and providing user profile-related data within the Virtual Stadium Data SDK.
The ProfileProvider handles all user profile operations and exposes profile data through observable state flows.
Fetching User Data
Retrieves detailed information about a user, such as their profile details, based on a user ID.
Providing User Avatar URL
Supplies the URL of the user's avatar image for display purposes.
Fetching Shared Bets
Retrieves the bets shared by a specific user with pagination support.
Access profile data through the ProfileProvider by injecting it via dependency injection.
The profileState flow exposes current profile data and updates automatically.
import ag.sportradar.virtualstadium.datasdk.services.ProfileProvider
import androidx.lifecycle.ViewModel
import org.koin.core.component.KoinComponent
import org.koin.core.component.get
class ProfileViewModel :
ViewModel(),
KoinComponent {
private val profileProvider: ProfileProvider
get() = get()
val profileState = profileProvider.profileState
fun getUserAvatar(userId: String): String =
profileProvider.getUserAvatarUrl(userId)
fun getUserData(userId: String) {
profileProvider.getUserData(userId)
}
fun getSharedBets(userId: String) {
profileProvider.getUsersSharedBets(userId)
}
fun getPreviousSharedBets(userId: String) {
profileProvider.getPreviousUsersSharedBets(userId)
}
}