android5-10 Exercise 2: Provides and Binds ====================================== @Provides @Singleton fun provideJson(): Json = Json { ignoreUnknownKeys = true } // and in provideNotesApi: add a parameter json: Json and use it instead of the global value Binding TimeProvider (Chapter 9, Exercise 2): @Binds abstract fun bindTimeProvider(impl: SystemTimeProvider): TimeProvider // SystemTimeProvider needs: class SystemTimeProvider @Inject constructor() : TimeProvider { ... } When to use which (general knowledge): @Binds when the implementation is a class Hilt can already construct (an @Inject constructor) and you only need to say which implementation answers for the interface. @Provides when you must write the construction yourself: a third-party class you cannot annotate, a builder (Room, Retrofit), or a configured value (Json). @Binds goes in an abstract class or interface module; @Provides in an object or a class. Code unrun.