https://kotlinlang.org logo
#android
Title
# android
k

kevin.cianfarini

06/14/2019, 5:46 PM
if I'm using retrofit to make a call to a no content endpoint, should I set the return type of the function to be
Call<Unit>
or
Call<Void>
?
l

louiscad

06/14/2019, 7:01 PM
You should use
Call<Void?>
and use built-in
await()
extension.
Also, #squarelibraries
k

kevin.cianfarini

06/14/2019, 7:03 PM
I wasn't sure that this post should have been there or here. I thought square doesn't do a majority of the development for retrofit?
could I mark the method as
suspend
and just mark the return type as
Void?
l

louiscad

06/14/2019, 7:29 PM
@kevin.cianfarini Suspend integration doesn't support nullable types yet, did you look at the changelog? Also, 204 and 205 bypass converters and always return null (that's a bug), so only
Call<Void?>
will work.
k

kevin.cianfarini

06/15/2019, 12:13 AM
Gotcha. I haven't delved too deep into the changelog yet so I wasn't aware.
g

grzesiekmq

06/15/2019, 9:19 AM
and to remind
Unit
is default return type