小编Asi*_*air的帖子

改造中的呼叫或响应?

我想知道 Call 和 Response 之间的区别?在 Retrofit 中何时使用Call和何时使用Response

@GET("/albums/{id}")
suspend fun functionOne(@Path(value = "id") albumsId:Int):Response<Albums>
@GET("/albums/{id}")
suspend fun functionTwo(@Path(value = "id") albumsId:Int):Call<Albums>
Run Code Online (Sandbox Code Playgroud)

这两个功能对我来说都很好,都有不同的实现,但目的几乎相同。

1. 什么样的响应类型有利于最佳实践?

2. 何时使用响应和呼叫?

android kotlin android-studio retrofit2 kotlin-coroutines

4
推荐指数
2
解决办法
2251
查看次数