https://kotlinlang.org logo
Title
c

Colton Idle

07/02/2022, 5:32 PM
Cool. That worked pretty easily.
val moshi = Moshi.Builder()
    .addLast(KotlinJsonAdapterFactory())
    .build()
        
val testResponse: TestResponse? = moshi.adapter(TestResponse::class.java).fromJsonValue(result.data)
return testResponse!!
Kinda based off of that. Should I store moshi globally? and then do moshi.adapter() at every callsite? Or is the adapter something that should be add() 'd to the moshi instance? edit: actually. maybe that actually doesn't make sense since the callsite needs to know the exact type at the callsite.