Cơ BảnAndroid iconAndroid

Retrofit là gì và hoạt động như thế nào?

Retrofit là HTTP client type-safe chuyển REST API thành Kotlin interface.

  • Bạn định nghĩa interface với method được annotate bằng HTTP verb như @GET, @POST, thêm kiểu request/response, và Retrofit tự sinh implementation.
  • Nó tự động deserialize JSON response thành Kotlin object, xử lý header, và hỗ trợ cả callback lẫn coroutine.
  • OkHttp là thư viện networking nền mà Retrofit dùng.

Xem toàn bộ Android cùng filter theo level & chủ đề con.

Mở danh sách Android