androidrx-javarx-java2rx-kotlin2

Convert Rxjava Completable to Map


I am need that i will be calling a completable method in the chain, after it completes, it needs to continue the chain with Map operator
Example

Single.just(someOperation())
     .flatMapCompletable{
         completableMethod()
    }
     .map{ // i need to continue here with map or some other operator
         doSomeOperation()
    }

Can anyone help me out with this ?


Solution

  • Completable does not submit any data. Accordigly you cannot call map. If you wan to perform any actions after this use andThen

    Single.just(someOperation())
         .flatMapCompletable{
             completableMethod()
        }
         .andThen{ 
             doSomeOperation()
        }
    

    More about andThen