Giter Site home page Giter Site logo

fastjetpack's Introduction

三种方式封装Retrofit+协程,实现优雅快速的网络请求

介绍

项目涉及到三种方式对Retrofit+协程的封装,每种封装**都不一样

就算对协程和Kotlin flow 不熟悉,也可以快速上手

封装的目的是为了减少模板代码,方便快速开发

分支解释

  • 封装一 (对应分支oneWay) 传递ui引用,可按照项目进行深度ui定制,方便快速,但是耦合高(Google 最近架构文档已经不推荐在Repository中使用LiveData了,这种方式主要提供一种封装**)

  • 封装二 (对应分支master) 耦合低,依赖的东西很少,但是写起来模板代码偏多

  • 封装三 (对应分支dev) 目的就是为了减少模板代码,引入了新的flow流式编程,链式调用,loading 和网络请求以及结果处理都在一起,很多时候甚至都不要声明 LiveData/Flow 对象。

根据谷歌官方文档的最新架构,推进使用dev分支。

博客地址

鸣谢

项目的部分思路来源于其他的开源项目,感谢其他作者的无私奉献。

项目调试Api来源于鸿阳大神的 wanandroid,多谢提供免费稳定的api。

希望大家和谐友好交流,共建开源社区。

项目会长期不定时更新优化...

fastjetpack's People

Contributors

ldlywt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.