DEV Community

leminhduc1202
leminhduc1202

Posted on

Answer: As ViewModelProviders.of() is deprecated, how should I create object of ViewModel?

Simply replace:

This:

boardViewModel = ViewModelProviders.of(this).get(BoardViewModel::class.java)

With this:

boardViewModel = ViewModelProvider(this).get(BoardViewModel::class.java)

Top comments (0)