Skip to content

基于Kotlin、协程、Retrofit的网络请求封装,快速简单轻便。

Notifications You must be signed in to change notification settings

ldlywt/FastJetpack

Repository files navigation

简体中文

Three ways to encapsulate Retrofit + Kotlin Coroutines for elegant and fast network requests

Introduction

This project involves three ways to encapsulate Retrofit + Kotlin Coroutines, each encapsulation idea is different.

Even if you are not familiar with the concatenation and Kotlin flow, you can get started quickly.

The purpose of the wrappers is to reduce boilerplate code and facilitate rapid development.

Branching Explained

  • Encapsulation 1 (corresponding to branch oneWay) passes ui references, allowing deep ui customization according to the project, which is fast and convenient, but highly coupled (Google's recent architecture documentation no longer recommends using LiveData in the repository). Google's recent architecture documentation no longer recommends the use of LiveData in the Repository, this approach mainly provides a kind of encapsulation of ideas)

  • Encapsulation two (corresponding to branch master) is low coupling, few dependencies, but more template code.

  • Encapsulation 3 (corresponding to branch dev) aims to reduce boilerplate code, introduces the new flow stream programming, chaining calls, loading and network requests and result processing are all together, and in many cases don't even declare the LiveData/Flow objects.

According to the latest architecture of Google's official documentation, advancing the use of dev branches.

Blog address

Acknowledgments

Some of the ideas of the project come from other open source projects, thanks to other authors for their selfless contributions.

The project debugging Api comes from wanandroid of Hongyang God, thanks for providing free and stable api.

I hope we can have a harmonious and friendly communication to build an open source community.

Translated with DeepL

Star History

Star History Chart

About

基于Kotlin、协程、Retrofit的网络请求封装,快速简单轻便。

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages