Krate ft. Moshi: a Kotlin library design case study
summary
Krate is a SharedPreferences wrapper that gets a Moshi-based addon implemented as delegates; code shows a working Krate SharedPreferences wrapper and a new Moshi adapter delegates class that serializes into prefs. The talk traces concrete fixes: replacing Gson type tokens with a Kotlin-based makeType, handling reified generics, debugging lists that returned LinkedTreeMap, and adding unit tests that initially fail for lists then pass after switching to Kotlin 1.4 java type support.
AI-written summary · about
chapters (10)
- 0:00Introduction to libraries
- 1:17Working with Crate
- 6:21Introduction to Moshi
- 11:01Json delegate challenges
- 17:04Testing crate delegates
- 19:24Integrating Moshi and Crate
- 23:23Reflection in Java and Kotlin
- 27:36Moshi delegate issues
- 31:18Refining type management
- 40:33Wrap up and resources
related talks
18mData Classes and Parsing Json-A Story About Converting Models to Kotlin
37mKotlin Multiplatform Library Development
40mMultiplatform Library Development
50mWhat’s new with Kotlin Multiplatform libraries?
41mAnnotation Processing in a Kotlin World
52mPowered by Kotlin
44mExploiting Kotlin Metadata + Annotation Processing
46mExploring the Kotlin Multiplatform Ecosystem
