Skip to content

Instantly share code, notes, and snippets.

@barbeau
Created May 24, 2021 18:48
Show Gist options
  • Save barbeau/e0b3a7a6e7195f38ed932712721029a4 to your computer and use it in GitHub Desktop.
Save barbeau/e0b3a7a6e7195f38ed932712721029a4 to your computer and use it in GitHub Desktop.
Medium article - Room + Flow for location updates
@Module
@InstallIn(SingletonComponent::class)
object DataModule {
@Provides
@Singleton
fun provideDatabase(@ApplicationContext context: Context): LocationDatabase =
LocationDatabase.create(context)
@Provides
fun provideDao(database: LocationDatabase): LocationDao {
return database.locationDao()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment