Android Fast Networking with Kotlin Coroutines

Android Fast Networking with Kotlin Coroutines

Play this article

Android Fast Networking is a great library for networking I am using since 2016, It has many features that are not available in similar networking libraries.

AFN provides direct support for RxJava but not for Coroutines, so we create by ourself

Adding AFN and Kotlin Coroutines to the project

implementation ''

// Android Fast Networking
implementation ''

// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'

In this project, we are using the State Management approach class Resource

The resource is a wrapper class that contains status (Loading, Success, Error), message, Data

Creating a BaseCaller, every API call will be going through this class, this is the class where the magic happens.

BaseApiModel is an API structure that is used for all APIs like, change as per requirements

  "status" : 200,
  "message" : "Api hit success",
  "data" : {
      "name" : "Yogesh Paliyal"