In one of my android(with Kotlin) app I want to use WorkManager class as a generic one. This is my class where I want to use it as generic by passing expected params:
class CommonWorkManager<P, R> (appContext: Context, workerParams: WorkerParameters) : Worker(appContext, workerParams)
{
var lambdaFunction: ((P) -> R)? = null
override fun doWork(): Result {
lambdaFunction
return Result.SUCCESS
}
}
This is how I am trying to create an instance of this class:
CommonWorkManager<Unit, Unit>(context!!, ).lambdaFunction= {
presenter?.fetchMasterData()
}
So How can I pass workerParams
as a second param.
Here 'P' is Parameter and 'R' is Return type in CommonWorkManager<P, R>