When you create a secondary constructor, and a class has non empty primary constructor, you should pass all parameters that primary constructor has, e.g.:
abstract class BaseAndroidViewModel(
application: Application,
private val creditsGetByIdUseCase: String,
private val videosGetByIdUseCase: String
) : AndroidViewModel(application) {
constructor(application: Application) : this(application,
"creditsGetByIdUseCase", "videosGetByIdUseCase") // here we pass other necessary parameters
}
In your case it might be the following:
@SuppressLint("StaticFieldLeak")
abstract class BaseAndroidViewModel(
application: Application,
private val creditsGetByIdUseCase: CreditsGetByIdUseCase?,
private val videosGetByIdUseCase: VideosGetByIdUseCase?,
private val reviewGetByIdUseCase: ReviewGetByIdUseCase?,
private val addToFavoritesUseCase: AddToFavoritesUseCase?,
private val getFavoriteByIdUseCase: GetFavoriteByIdUseCase?
) : AndroidViewModel(application) {
constructor(application: Application) : this(application, null, null, null, null, null)
}
Or you can create primary constructor with default parameters:
abstract class BaseAndroidViewModel(
application: Application,
private val creditsGetByIdUseCase: CreditsGetByIdUseCase? = null,
private val videosGetByIdUseCase: VideosGetByIdUseCase? = null,
private val reviewGetByIdUseCase: ReviewGetByIdUseCase? = null ,
private val addToFavoritesUseCase: AddToFavoritesUseCase? = null,
private val getFavoriteByIdUseCase: GetFavoriteByIdUseCase? = null
) : AndroidViewModel(application) { ... }