我想在 WorkManager 中注入共享 viewModel。但
by sharedViewModel<MyModel>()
没有解决。
class MyCoroutineWorker(context: Context, params: WorkerParameters):CoroutineWorker(context, params)
, KoinComponent {
override val coroutineContext = Dispatchers.IO
val gameListModel by sharedViewModel<MyModel>()
override suspend fun doWork(): Result = coroutineScope {
Result.success()
}
}
任何建议表示赞赏。