flatMapIf

fun <T : Any> Single<T>.flatMapIf(predicate: Boolean, mapper: (T) -> Single<T>): Single<T>

Chains a flapMap to this if predicate is true, applying mapper to the item emitted by the source Single.

Return

the new Single if predicate is true, the original Single otherwise

Parameters

predicate

whether or not the mapper function will be applied

mapper

function to transform the emitter item