I am trying out hilt and i want to inject moshi for serializing and deserializing.
Here's a code sample from a github Repo which is not using di:
open class InfoTypeConverter {
private val moshi = Moshi.Builder().build() //not using dependency injection
@TypeConverter
fun fromString(value: String): PokemonInfo.Type? {
val adapter: JsonAdapter<PokemonInfo.Type> = moshi.adapter(PokemonInfo.Type::class.java)
return adapter.fromJson(value)
}
@TypeConverter
fun fromInfoType(type: PokemonInfo.Type): String {
val adapter: JsonAdapter<PokemonInfo.Type> = moshi.adapter(PokemonInfo.Type::class.java)
return adapter.toJson(type)
}
}
I am Trying out random stuff to field inject this like annotaion with @AndroidEntryPoint/@EntryPoint and obviously it's not working.