Is there any support for making network request wi...
# multiplatform
r
Is there any support for making network request with a multiplatform kotlin project
🤔 1
s
Not built in. You would have to use an expect/actual class to make your network call and then use each platform’s method for making the network call.
a
What's nice is retrofit uses interfaces. So you in theory could use interface in common code that you only implement in iOS or js land
j
I'm working on one, but it's not done yet. If you don't need it immediately, I should be done with it by this weekend.
a
@agrosner Good idea. But
retrofit
like
room
, you need to use decorators, then it will pollute your model layer. So, any ideas for solving this? Extending the existing interface from
common
and decorate it in android? 🙂 I have my cross platform get() and post(), but thinking of using
retrofit
.
a
that might be valid. keeps the annotations away from other platforms. you can
expect
interface from common and actual it with decoration (i think thats possible)
what we need is a cross platform networking library, then retrofit's need is less when you use interface and implementation. rather than implementing each platform version differently
n
In order for that to happen the solution would need to be written in Kotlin end to end (all platforms).
a
Yes and either support full reflection or kapt