Epsilon SDK follows modern Android and Kotlin Multiplatform development patterns. While it is designed to be flexible, adhering to these patterns ensures better integration and maintainability.
This page focuses on recommended integration patterns for projects that adopt Epsilon SDK modules.
The SDK promotes the Model-View-ViewModel (MVVM) architecture.
ViewModels should be handled in a platform-agnostic way.
androidx.lifecycle.ViewModel.States should be immutable data classes. Use StateFlow to expose state from ViewModels to the UI.
Example state setup
data class MyState(
val isLoading: Boolean = false,
val data: List<String> = emptyList(),
val error: String? = null
)
class MyViewModel : ViewModel() {
private val _state = MutableStateFlow(MyState())
val state: StateFlow<MyState> = _state.asStateFlow()
fun loadData() {
viewModelScope.launch {
_state.update { it.copy(isLoading = true) }
// ... load data
_state.update { it.copy(isLoading = false, data = result) }
}
}
}When using epsilon-networking, follow these best practices:
NetworkResponse<T> to wrap your API calls. It handles success and failure cases gracefully.NetworkErrorResolver to map HTTP errors to domain-specific error models.Dispatchers.IO for network operations to ensure optimal performance across platforms. The default implementation in Epsilon uses Dispatchers.IO for all targets except JavaScript, which uses Dispatchers.Default.epsilon-string module to manage localized strings and colors. This allows you to share resources between Android and iOS.onBackClick, isSubmitting).The Epsilon SDK is designed to be DI-agnostic. While Sportradar projects often use Koin, the SDK itself does not enforce any specific DI framework, allowing it to be used in any project environment.
For project setup details, continue with the Integration Guide.