Retrofit
# android
j
Retrofit
j
Thanks @jw, it was more about how the public APIs where written, ie retrofit in java uses a builder that you provider adapters, would you recommend the same structure in kotlin with all the null’s around?
or just work with lateinit/defaults for all of it?
to be more specific, lets say my lib builds an object that depends on another that you build if not started, would this be a good approach?
Copy code
fun build() = {
            if (!::okHttpClient.isInitialized) {
                okHttpClient = defaultOkHttpClient(loggingInterceptor)
            }
...
f
@James Coggan @antonioleiva has some really nice examples of how using Retrofit in Kotlin can be much simpler than in Java
one sec I dig up some links
j
this more a builder question than retrofit 😉
f
ok, well anyway here’s a write up from him https://antonioleiva.com/retrofit-android-kotlin/
j
To your specific example, I'd use nullable not lateinit
If I rewrote Retrofit in Kotlin I wouldn't change much
j
thanks!
appreciate it
i did feel
isInitialized
is a bit of a smell
@fuad ty anyway
👍 1