I would like create an widget and sent args into. I have Widget class extends Broadcast receiver and I use Hilt. How I can get viewModel in my Widget class? I try use standard way but the viewModel is not found and highlighted by red.
My Widget class
@AndroidEntryPoint
class Widget: AppWidgetProvider() {
private val viewModel: HomeViewModel by viewModels()
...
my ViewModel
@HiltViewModel
class HomeViewModel @Inject constructor(
private val weatherRepo: WeatherRepo,
private val locationTracker: LocationTracker
) : ViewModel() {
...