You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the AppComponent, there is Builder which can be replaced with the interface Factory : AndroidInjector.Factory<MyApplication> as Builder is deprecated in the latest version of Dagger.
The fun inject(instance: MyApplication) can be removed as DaggerApplication class handles the field injections in the Application class.
The @BindsInstance function can be removed as the Factory generates this code for us.
Coroutines:
We can use withContext() function to switch threads in a coroutine instead of launching a new coroutine in separate thread each time.
Every function should handle the thread switching for proper execution of its body instead of relying on the caller of the function.
There is no thread switching needed for the database operations if the function in Dao is marked as suspend. Room uses a custom dispatcher optimised for the database operations.
The text was updated successfully, but these errors were encountered:
Dagger:
AppComponent
, there isBuilder
which can be replaced with theinterface Factory : AndroidInjector.Factory<MyApplication>
asBuilder
is deprecated in the latest version of Dagger.fun inject(instance: MyApplication)
can be removed asDaggerApplication
class handles the field injections in theApplication
class.@BindsInstance
function can be removed as theFactory
generates this code for us.Coroutines:
withContext()
function to switch threads in a coroutine instead of launching a new coroutine in separate thread each time.suspend.
Room uses a custom dispatcher optimised for the database operations.The text was updated successfully, but these errors were encountered: